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

"Sync Now" should synchronize "meta" database when pressed #7121

Closed
mrsarm opened this issue May 31, 2021 · 5 comments · Fixed by #7122
Closed

"Sync Now" should synchronize "meta" database when pressed #7121

mrsarm opened this issue May 31, 2021 · 5 comments · Fixed by #7122
Assignees
Labels
Type: Improvement Make something better
Milestone

Comments

@mrsarm
Copy link
Contributor

mrsarm commented May 31, 2021

What feature do you want to improve?
When users press "Sync Now" , only the device's main database is synchronized (the database with the reports, tasks, messages..). The "meta" database that contains feedback and telemetry documents is only synchronized by a cron job each 30 min, and if there is no connection by the time, another 30 min of waiting are needed to successfully synchronize.

Describe the improvement you'd like
When user clicks "Sync Now", the meta DB should also be synchronized. One synchronization shouldn't affect the sync of the another.

Describe alternatives you've considered
This was not requested by any particular partner or user, but would be a nice to have now that we are increasing the quality and sync frequency of "meta" data. Also is a one line patch, that going to attach to the issue.

Additional context
The size of the request needed to do the synchronization is still little data, it won't affect data caps if the data is synchronized with a mobile data plan instead of WiFi, because taking into account compression used by the devices and that only new data is syncronized, only a few kilobytes are consumed. Moreover, because we put the user in control of when to synchronize, we avoid waste of data spend by requests made automatically by the app because the user can choose to do the sync when is connected to a WiFi connection.

@mrsarm mrsarm added the Type: Improvement Make something better label May 31, 2021
@mrsarm mrsarm self-assigned this Aug 26, 2021
@mrsarm mrsarm added this to Ready for dev in Allies Workstream - DEPRECATED via automation Aug 26, 2021
@mrsarm mrsarm linked a pull request Aug 26, 2021 that will close this issue
@mrsarm mrsarm moved this from Ready for dev to Dev in progress in Allies Workstream - DEPRECATED Aug 26, 2021
@mrsarm
Copy link
Contributor Author

mrsarm commented Sep 15, 2021

Ready for AT, PR #7122 , branch sync-now-meta.

Testing

This is how I tested locally the changes:

  1. Login with any user either from a desktop browser or the app, and do some clicks to let the app record some telemetry and then logout.
  2. Change the time of the device to next day. Go back to the app, and do some more clicks.
  3. Check the user meta database of the user, e.g. if the username is mariano, the db is medic-user-mariano-meta. It should have a bunch of telemetry-YEAR-MONTH-DAY-mariano-RANDOMUUID records, but not yet a record from the current date. E.g. the current day is Sep 15 2021 and you moved the clock to Sep 16 2021, but you shouldn't have yet a record with the _id telemetry-2021-9-15-mariano-RANDOMUUID.
  4. Login again, and check the DB (without logout). Still you don't have the telemetry record for Sep 15.
  5. Click the Hamburger menu > "Sync now".
  6. Ceck again the DB, now you should see the record for Sep 15.

@mrsarm mrsarm moved this from Dev in progress to Ready for AT in Allies Workstream - DEPRECATED Sep 15, 2021
@newtewt newtewt moved this from Ready for AT to AT in progress in Allies Workstream - DEPRECATED Sep 15, 2021
@newtewt
Copy link
Contributor

newtewt commented Sep 15, 2021

Tested logging bugs don't sync with other docs but sync on Sync Now
Tested using the test page and generating feed back docs. Syncs on the Sync now button or app refreshed and sync occurs naturally.

@mrsarm does this require a one day lag period for telemetry?

Logged in as a new offline user.
Have a bunch of telemetry docs on my local storage.
Click sync now.
No telemetry is synced.

@mrsarm
Copy link
Contributor Author

mrsarm commented Sep 15, 2021

does this require a one day lag period for telemetry?

@newtewt yes because what are synchronized are the records from previous days (summarized in one record each day). Step 2 here suggests to change the clock time one day forward.

Also not mention because it's unlikely: sentinel moves each XX time records from each user's meta DB to the medic-users-meta database. If you don't find the record in the user's meta, checkout the other, or just stop sentinel while doing the test.

@newtewt
Copy link
Contributor

newtewt commented Sep 15, 2021

Cool, just thought it to be odd that sync now still requires a daily cycle process to sync now.

After adjusting my date the telemetry logged.

I think this is working as expected and we can move on.

@newtewt newtewt moved this from AT in progress to Ready to merge in Allies Workstream - DEPRECATED Sep 15, 2021
@mrsarm
Copy link
Contributor Author

mrsarm commented Sep 16, 2021

Cool, just thought it to be odd that sync now still requires a daily cycle process to sync now.

Yes I myself got the same confusion testing the change 😄

Allies Workstream - DEPRECATED automation moved this from Ready to merge to Done Sep 16, 2021
@mrsarm mrsarm added this to the 3.13.0 milestone Sep 16, 2021
@jkuester jkuester changed the title "Sync Now" should syncronize "meta" database when pressed "Sync Now" should synchronize "meta" database when pressed Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Make something better
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants