fix(sync): re-arm a recovery probe that died while offline (closes #207) - #212
Merged
Merged
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.
Problem
After a period without connectivity, folders stayed Offline and never synced again on their own; only a manual sync (or an app restart) recovered them.
Root cause, in the scheduler:
start(). If it fires while the machine is offline,startaborts on!self.online- and the timer is gone for good (it is only ever re-armed fromfinished(NetworkError)).set_online(true)requestsTrigger::NetworkRestored, butrequest()parks it behind theserver_unreachablegate (onlyManualpasses). Nothing re-arms the probe, so the folder sits queued forever.Fix
In
set_online(true)(!was_online), when theserver_unreachablegate is still armed: queue aRetryand callschedule_server_probe(). The probe guard (start_source) makes this a no-op when a probe is already pending, so the common path (network flapped before the probe fired) is unaffected. Once the probe fires with connectivity back, the engine runs, and the first success clears the gate - no manual sync, no restart.Test (red-green)
network_restore_rearms_a_probe_that_died_while_offline: arm the gate via NetworkError, fire the probe while offline (assert the timer died and no engine run started), then restore the network and assert the probe is re-armed, a run starts, and Success returns the folder to IdleOk.--all-targetsclean, fmt clean.