Skip to content

Simplify control flow in sync iteration - #82

Open
Chriztiaan wants to merge 3 commits into
mainfrom
sync-client-control-flow
Open

Simplify control flow in sync iteration#82
Chriztiaan wants to merge 3 commits into
mainfrom
sync-client-control-flow

Conversation

@Chriztiaan

@Chriztiaan Chriztiaan commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

This ports similar changes from the JS SDK (itself a port of powersync.dart#410) to the sync client in the .NET SDK.

Addresses #81.

When a sync stream closed, a few already-queued messages could still be sent to the sync core after it had stopped listening. Those turned into No iteration is active errors that surfaced in crash reporting without the app being
able to catch them.

The iteration now processes everything in one sequential loop rather than alongside a background task, so once a stream ends nothing further is sent. Also uses the core's newer connection command to report connect/disconnect state instead of setting it manually, and makes stream read failures flow into the normal retry path.

AI disclosure

This PR was created with the help of Claude Opus 4.8. Help constitutes assistance in research, planning, and rough outline of implementation. Beyond having a hand in the implementation, I have also manually tested this work.

@Chriztiaan
Chriztiaan requested a review from LucDeCaf July 27, 2026 12:10
Comment thread PowerSync/PowerSync.Common/Client/Sync/Stream/CoreInstructions.cs Outdated
`NonInterruptingInstruction` abstract subclass, matching powersync.dart.
@Chriztiaan
Chriztiaan marked this pull request as ready for review July 28, 2026 09:53
Comment thread Tests/PowerSync/PowerSync.Common.Tests/Client/Sync/SyncIterationTeardownTests.cs Outdated
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