Skip to content

Start one periodic sync loop when called at once - #89

Merged
ellykits merged 1 commit into
mainfrom
fix-periodic-sync-race
Oct 28, 2026
Merged

ellykits merged 1 commit into
mainfrom
fix-periodic-sync-race

Conversation

@ellykits

@ellykits ellykits commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem: Sync.runPeriodicSync checks for a running loop and registers the new one under two separate lock acquisitions. Concurrent calls on desktop and web each start their own periodic loop, and cancelPeriodicSync stops only the last one.

Fix: check and launch under a single lock, so only one loop exists per sync name.

simultaneousPeriodicStartsRunOneLoop covers it (20 concurrent starts → 1 loop) and replaces periodicSync_calledTwice_doesNotStartASecondCompetingLoop, which passed even with the bug.

@ellykits
ellykits merged commit c8f0e52 into main Oct 28, 2026
5 checks passed
@ellykits
ellykits deleted the fix-periodic-sync-race branch October 28, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants