Open gino-m opened 1 week ago
@shobhitagarwal1612 Let's clean split this work up and make this airtight.
Should we also add a manual button to trigger data sync?
Should we also add a manual button to trigger data sync?
The current behavior is to automatically retry whenever a connection is available, and I plan to add logic to periodically check the queue in case the last sync crashed. In that case, what purpose would the button serve? My concern is that by adding a button users will think they need to click it to have data be uploaded.
The current data sync workflow is complicated, making it hard to understand and prone to errors (#2726, #2377, #2751, #2684). This is arguably most critical part of the system, so improving this should be P0+ priority.
The main components in question are
LocalMutationSyncWorker
,MediaUploadWorker
, andSyncStatusViewModel
and related fragment and repositories.Suggestions:
UploadQueueEntry
model object, grouping create LOI+submission mutations together, sorted in reverse chronological order (oldest first, FIFO).LocalMutationSyncWorker
as follows:LocalMutationSyncWorker
running at a time, this should be safe.retry()
the worker.LocalMutationSyncWorker
on "submit", also trigger periodically (15 min?) to catch any "stuck" mutations, ie in case the worker crashed before it couldretry()
for some reason.UploadQueueEntry
s returned by the repo.Mutation.SyncStatus
and split offUploadQueueEntry.Status
See also https://github.com/google/ground-android/issues/2235
@shobhitagarwal1612 @scolsen @sufyanAbbasi @jabramowitz5 @lecrabe @jo-spek @kenstershiro I would suggest prioritizing this over all other feature requests. Let's discuss.