ground-android icon indicating copy to clipboard operation
ground-android copied to clipboard

[Offline support] App doesn't sync data after max retries of sync errors

Open gino-m opened this issue 6 years ago • 5 comments

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.

gino-m avatar Jul 16 '19 00:07 gino-m

@sufyanAbbasi Can you increase MAX_RETRIES to some large number as a workaround?

gino-m avatar Mar 14 '24 17:03 gino-m

I found two interesting things...

  1. ~incrementRetryCount() is only called in the MediaUploadWorker for 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?)!~
    1. ~Fixing it may not be the correct thing to do here.~
  2. ~We don't mark mutations as COMPLETE anywhere except for the MediaUploadWorker after 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.

sufyanAbbasi avatar Mar 15 '24 00:03 sufyanAbbasi

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.

sufyanAbbasi avatar Mar 15 '24 00:03 sufyanAbbasi

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!

sufyanAbbasi avatar Mar 22 '24 00:03 sufyanAbbasi

I'll grab time to discuss tomorrow, thanks!

gino-m avatar Mar 24 '24 09:03 gino-m