File tree 1 file changed +12
-2
lines changed
packages/powersync_core/lib/src/sync
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,18 @@ class StreamingSyncImplementation implements StreamingSync {
89
89
final future = abort.abort ();
90
90
_internalCrudTriggerController.close ();
91
91
92
- // This makes the merged stream emit a done event, allowing us to break
93
- // out of the loop.
92
+ // If a sync iteration is active, the control flow to abort is:
93
+ //
94
+ // 1. We close the non-line sync event stream here.
95
+ // 2. This emits a done event.
96
+ // 3. `addBroadcastStream` will cancel all source subscriptions in
97
+ // response to that, and then emit a done event too. If there is an
98
+ // error while cancelling the stream, it's forwarded by emitting an
99
+ // error before closing.
100
+ // 4. We break out of the sync loop (either due to an error or because
101
+ // all resources have been closed correctly).
102
+ // 5. `streamingSync` completes the abort controller, which we await
103
+ // here.
94
104
await _nonLineSyncEvents.close ();
95
105
96
106
// Wait for the abort to complete, which also guarantees that no requests
You can’t perform that action at this time.
0 commit comments