ground-android
ground-android copied to clipboard
[Offline support] App doesn't sync data after max retries of sync errors
When retry count mutations exceeds some limit, show notification or other affordance to allow user to revert changes or to try again. Follow-up to #147.
@sufyanAbbasi Can you increase MAX_RETRIES to some large number as a workaround?
I found two interesting things...
- ~
incrementRetryCount()is only called in theMediaUploadWorkerfor media upload, but not anywhere else. The implication is that retry count doesn't change therefore, we're never not retrying failed tasks (task failed successfully?)!~- ~Fixing it may not be the correct thing to do here.~
- ~We don't mark mutations as
COMPLETEanywhere except for theMediaUploadWorkerafter the media mutation upload is complete. I'm not sure if this is intentional or not.~
Ah, I think I get it, all mutations get marked as MEDIA_UPLOAD_PENDING which is handled by that worker when it gets enqueued.
From what I understand, we mark all mutations as having failed when one mutation fails, since the FireStore mutations are done in bulk: in LocalMutationSyncWorker:121: remoteDataStore.applyMutations(mutations, user). Since if any fail, none of them will be committed, we want to mark all of these mutations as having failed.
Therefore, if we're retrying uploads, we should consider breaking up the failed mutations into their own worker pool to prevent overloading the network.
Unassigning myself for now, since I don't have a full understanding of the mutation/worker/sync model and I don't want to mess it up. But I'm happy to work on it if I can peer program with someone on it!
I'll grab time to discuss tomorrow, thanks!