Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload treatments to multiple Nightscout sites #3630

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Navid200
Copy link
Collaborator

Fixes: #266

xDrip only uploads treatments to the first site if the user enters multiple URLs separated by space as the base URL.

I have confirmed this is because during the very first run of the for loop going through the multiple sites, the treatment upload queue is completed (up.completed).

I have added a counter to detect the last run and made the completed commands conditional on being in the last run of the loop.
My tests show that treatments are now uploaded to multiple sites.

I did the auto format because the indentations are very confusing.

I had unintentionally left some test logs in a previous PR. I have removed those.

@Navid200
Copy link
Collaborator Author

These are the changes:
Screenshot 2024-08-17 193249

Screenshot 2024-08-17 193424

Screenshot 2024-08-17 194127
Screenshot 2024-08-17 194303
Screenshot 2024-08-17 194418
Screenshot 2024-08-17 194552
Screenshot 2024-08-17 195211
Screenshot 2024-08-17 195259

@Navid200
Copy link
Collaborator Author

Navid200 commented Sep 5, 2024

I created two new free Nightscout sites using our Google Cloud scheme.

I used a test phone with xDrip as a follower of my active xDrip on my main phone.
I set up this test phone to upload to both new test Nightscout sites.
The test phone uploaded readings to both test sites successfully.

First, before making any changes, I added lots of logs to make the behavior of xDrip on the test phone obvious.
When adding treatments on the test phone, I could see that they were only uploaded to the first site, but not the second.
The logs showed that while the first run of the loop addressing the two sites was executed, the queue would be terminated by xDrip resulting in treatments not being uploaded to the second site.

After adding the changes in this PR to xDrip, treatments were uploaded to both sites.
Yet, the logs showed that the queue was terminated after the second upload was completed and no more uploads were attempted.

@Navid200
Copy link
Collaborator Author

Navid200 commented Sep 5, 2024

I am not 100% sure. But, it may be that the queue has a wider scope than it should have. Therefore, when it is completed inside a member of the loop, when the next member of the loop attempts to recreate the same queue, it fails.

So, I am sure there are other ways to fix this issue. I have fixed it by making the completion conditional. So, when the second member of the loop attempts to create the queue and it sees that it already exists, I suppose it does not recreate it.

Please tell me how I can help to make the review easier.

Would it help if I undo the auto formatting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upload of "eventType: Sensor Start" to the Nightscout treatments works only to 1st NS site
1 participant