Repository navigation
fix(sync): sum remaining blocks across devices in data sync progress - #212
Draft
gmaclennan wants to merge 2 commits into
Draft
gmaclennan wants to merge 2 commits into
gmaclennan wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When syncing with more than one device at once, the data sync progress reported by
useDataSyncProgresscan jump to 1 (complete) while another peer, typically the cloud archive, still has blocks to exchange. It looks intermittent because it only shows when the device that finished first happens to be the last one enumerated.The cause is in
src/lib/sync.ts: inside the loop over enabled devices,totalMaxSyncCountis accumulated with+=butcurrentSyncCountis assigned with=, so only the last device's remaining count survives. The change makes it+=so progress reflects the remaining blocks across all devices.The new test in
test/lib/sync.test.tsdrivesSyncStoredirectly with a fake$syncrather than real IPC peers, since the existing progress test inprojects.test.tsxhas no multi-peer setup. It can move there if the hook-level route is preferred.Related changes. A premature "complete" is one of the reasons people leave the Exchange screen or press Stop while the cloud still wants blocks. digidem/comapeo-mobile#2213 keeps the server connection when the user leaves anyway, and digidem/comapeo-core#1353 keeps serving after Stop. This fix is independent of both and the cheapest of the three.