File tree Expand file tree Collapse file tree 12 files changed +37
-22
lines changed
supabase-edge-function-auth
powersync_attachments_helper Expand file tree Collapse file tree 12 files changed +37
-22
lines changed Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ packages:
342342 path: "../../packages/powersync"
343343 relative: true
344344 source: path
345- version: "1.3.0-alpha.1 "
345+ version: "1.3.0-alpha.2 "
346346 realtime_client:
347347 dependency: transitive
348348 description:
@@ -464,10 +464,10 @@ packages:
464464 dependency: "direct main"
465465 description:
466466 name: sqlite_async
467- sha256: "91f454cddc85617bea2c7c1544ff386887d0d2cf0ecdb3599015c05cc141ff4d "
467+ sha256: "7a68036b2fc2fae5fc0efbc6bd436deb79e39090282348d979e6a7c38c8d067e "
468468 url: "https://pub.dev"
469469 source: hosted
470- version: "0.7.0-alpha.1 "
470+ version: "0.7.0-alpha.2 "
471471 stack_trace:
472472 dependency: transitive
473473 description:
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ dependencies:
1616 supabase_flutter : ^2.0.2
1717 path : ^1.8.3
1818 logging : ^1.2.0
19- sqlite_async : ^0.7.0-alpha.1
19+ sqlite_async : ^0.7.0-alpha.2
2020 universal_io : ^2.2.2
2121
2222dev_dependencies :
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ packages:
342342 path: "../../packages/powersync"
343343 relative: true
344344 source: path
345- version: "1.3.0-alpha.1 "
345+ version: "1.3.0-alpha.2 "
346346 realtime_client:
347347 dependency: transitive
348348 description:
@@ -464,10 +464,10 @@ packages:
464464 dependency: "direct main"
465465 description:
466466 name: sqlite_async
467- sha256: "91f454cddc85617bea2c7c1544ff386887d0d2cf0ecdb3599015c05cc141ff4d "
467+ sha256: "7a68036b2fc2fae5fc0efbc6bd436deb79e39090282348d979e6a7c38c8d067e "
468468 url: "https://pub.dev"
469469 source: hosted
470- version: "0.7.0-alpha.1 "
470+ version: "0.7.0-alpha.2 "
471471 stack_trace:
472472 dependency: transitive
473473 description:
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ dependencies:
1616 supabase_flutter : ^2.0.2
1717 path : ^1.8.3
1818 logging : ^1.2.0
19- sqlite_async : ^0.7.0-alpha.1
19+ sqlite_async : ^0.7.0-alpha.2
2020 universal_io : ^2.2.2
2121
2222dev_dependencies :
Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ packages:
374374 path: "../../packages/powersync"
375375 relative: true
376376 source: path
377- version: "1.3.0-alpha.1 "
377+ version: "1.3.0-alpha.2 "
378378 realtime_client:
379379 dependency: transitive
380380 description:
Original file line number Diff line number Diff line change @@ -430,7 +430,7 @@ packages:
430430 path: "../../packages/powersync"
431431 relative: true
432432 source: path
433- version: "1.3.0-alpha.1 "
433+ version: "1.3.0-alpha.2 "
434434 powersync_attachments_helper:
435435 dependency: "direct main"
436436 description:
@@ -559,10 +559,10 @@ packages:
559559 dependency: "direct main"
560560 description:
561561 name: sqlite_async
562- sha256: "91f454cddc85617bea2c7c1544ff386887d0d2cf0ecdb3599015c05cc141ff4d "
562+ sha256: "7a68036b2fc2fae5fc0efbc6bd436deb79e39090282348d979e6a7c38c8d067e "
563563 url: "https://pub.dev"
564564 source: hosted
565- version: "0.7.0-alpha.1 "
565+ version: "0.7.0-alpha.2 "
566566 stack_trace:
567567 dependency: transitive
568568 description:
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ dependencies:
1717 supabase_flutter : ^2.0.1
1818 path : ^1.8.3
1919 logging : ^1.2.0
20- sqlite_async : ^0.7.0-alpha.1
20+ sqlite_async : ^0.7.0-alpha.2
2121 camera : ^0.10.5+7
2222 image : ^4.1.3
2323 universal_io : ^2.2.2
Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ Future<void> _powerSyncDatabaseIsolate(
332332 updateStream: updateController.stream,
333333 retryDelay: args.retryDelay,
334334 client: http.Client ());
335- sync .streamingSync ();
335+ sync .streamingSync (null );
336336 sync .statusStream.listen ((event) {
337337 sPort.send (['status' , event]);
338338 });
Original file line number Diff line number Diff line change @@ -125,7 +125,16 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
125125 /// Use [connect] to connect again.
126126 Future <void > disconnect () async {
127127 if (disconnecter != null ) {
128- await disconnecter! .abort ();
128+ /// Checking `disconnecter.aborted` prevents race conditions
129+ /// where multiple calls to `disconnect` can attempt to abort
130+ /// the controller more than once before it has finished aborting.
131+ if (disconnecter! .aborted == false ) {
132+ await disconnecter! .abort ();
133+ disconnecter = null ;
134+ } else {
135+ /// Wait for the abort to complete. Continue updating the sync status after completed
136+ await disconnecter! .onAbort;
137+ }
129138 }
130139 setStatus (
131140 SyncStatus (connected: false , lastSyncedAt: currentStatus.lastSyncedAt));
Original file line number Diff line number Diff line change @@ -124,8 +124,7 @@ class PowerSyncDatabaseImpl
124124
125125 // Disconnect if connected
126126 await disconnect ();
127- final disconnector = AbortController ();
128- disconnecter = disconnector;
127+ disconnecter = AbortController ();
129128
130129 await isInitialized;
131130
@@ -145,7 +144,7 @@ class PowerSyncDatabaseImpl
145144 sync .statusStream.listen ((event) {
146145 setStatus (event);
147146 });
148- sync .streamingSync ();
147+ sync .streamingSync (disconnecter );
149148 }
150149
151150 /// Takes a read lock, without starting a transaction.
You can’t perform that action at this time.
0 commit comments