Code health improvements which came up while fixing #2129:
Recommended:
[ ] Warn and ignore mutations not belonging to current signed in user (#2237)
[ ] Wrap remoteDataStore.applyMutations in MutationRepository
[x] #2236
Nice to have:
[ ] Log an error if "create" submissions were enqueued after "edit" submissions
[ ] Replace MutationRepository.markAs.. methods with saveMutationsLocally and helper on Mutation
[ ] Improve naming of finalizePendingMutationsForMediaUpload() and finalizeDeletions()
[ ] Only call enqueueSyncWorker() if media uploads are pending for this LOI
[ ] Extract business logic into UserDataUploadUseCase
[ ] Move getPendingOrEligibleFailedMutations() into repository (#2237)
Not needed:
~Stop marking all mutations for an LOI as IN_PROGRESS at once. Instead, process each mutation individually, and set IN_PROGRESS before actually processing.~
We do this because we process mutations in batch.
~Abort updates to this LOI if any mutations were unsuccessful~
Mutations are applied as a batch write, which are atomic.
@scolsen Breaking these out so we can keep moving forward
Code health improvements which came up while fixing #2129:
Recommended:
remoteDataStore.applyMutations
inMutationRepository
Nice to have:
MutationRepository.markAs..
methods withsaveMutationsLocally
and helper onMutation
finalizePendingMutationsForMediaUpload()
andfinalizeDeletions()
enqueueSyncWorker()
if media uploads are pending for this LOIUserDataUploadUseCase
getPendingOrEligibleFailedMutations()
into repository (#2237)Not needed:
IN_PROGRESS
at once. Instead, process each mutation individually, and setIN_PROGRESS
before actually processing.~@scolsen Breaking these out so we can keep moving forward