Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/honest-penguins-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/common': patch
---

Fix issue where Rust sync implementation might not disconnect in some circumstances.
4 changes: 4 additions & 0 deletions packages/common/src/client/sync/stream/AbstractRemote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ export abstract class AbstractRemote {
* Aborting the active fetch request while it is being consumed seems to throw
* an unhandled exception on the window level.
*/
if (abortSignal?.aborted) {
throw new AbortOperation('Abort request received before making postStreamRaw request');
}

const controller = new AbortController();
let requestResolved = false;
abortSignal?.addEventListener('abort', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,9 @@ The next upload iteration will be delayed.`);
let receivingLines: Promise<void> | null = null;
let hadSyncLine = false;

if (signal.aborted) {
throw new AbortOperation('Connection request has been aborted');
}
const abortController = new AbortController();
signal.addEventListener('abort', () => abortController.abort());

Expand Down