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 {
30
30
31
31
// An internal controller which is used to trigger CRUD uploads internally
32
32
// 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.
33
35
final StreamController <Null > _internalCrudTriggerController =
34
36
StreamController <Null >.broadcast ();
35
37
@@ -164,6 +166,11 @@ class StreamingSyncImplementation {
164
166
Future <void > crudLoop () async {
165
167
await uploadAllCrud ();
166
168
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.
167
174
await for (var _ in StreamGroup .merge (
168
175
[crudUpdateTriggerStream, _internalCrudTriggerController.stream])) {
169
176
if (_abort? .aborted == true ) {
You can’t perform that action at this time.
0 commit comments