Skip to content

Commit 5872ed6

Browse files
committed
Check if abort future is completed before completing it
1 parent 0e03710 commit 5872ed6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/powersync/lib/src/abort_controller.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ class AbortController {
1717
/// Abort, and wait until aborting is complete.
1818
Future<void> abort() async {
1919
aborted = true;
20-
_abortRequested.complete();
20+
if (!_abortRequested.isCompleted) {
21+
_abortRequested.complete();
22+
}
2123

2224
await _abortCompleter.future;
2325
}
2426

2527
/// Signal that an abort has completed.
2628
void completeAbort() {
27-
_abortCompleter.complete();
29+
if (!_abortCompleter.isCompleted) {
30+
_abortCompleter.complete();
31+
}
2832
}
2933

3034
/// Signal that an abort has failed.

0 commit comments

Comments
 (0)