Skip to content

Commit ed582bb

Browse files
cleanup
1 parent 4df902c commit ed582bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/powersync/lib/src/streaming_sync.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class StreamingSyncImplementation {
3030

3131
// An internal controller which is used to trigger CRUD uploads internally
3232
// e.g. when reconnecting.
33+
// This is only a broadcast stream since the `crudLoop` method is public
34+
// and could potentially be called multiple times externally.
3335
final StreamController<Null> _internalCrudTriggerController =
3436
StreamController<Null>.broadcast();
3537

@@ -164,6 +166,11 @@ class StreamingSyncImplementation {
164166
Future<void> crudLoop() async {
165167
await uploadAllCrud();
166168

169+
// Trigger a CRUD upload whenever the upstream trigger fires
170+
// as-well-as whenever the sync stream reconnects.
171+
// This has the potential (in rare cases) to affect the crudThrottleTime,
172+
// but it should not result in excessive uploads since the
173+
// sync reconnects are also throttled.
167174
await for (var _ in StreamGroup.merge(
168175
[crudUpdateTriggerStream, _internalCrudTriggerController.stream])) {
169176
if (_abort?.aborted == true) {

0 commit comments

Comments
 (0)