File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
packages/powersync/lib/src Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments