Skip to content

Commit 95591d3

Browse files
Clear retryOps on error (#59)
* fix: clear retry ops after failure * update changeset * delete markdown
1 parent eac3256 commit 95591d3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/wild-pants-shave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@journeyapps/wa-sqlite': patch
3+
---
4+
5+
Clear retryOps after waiting for ops. This can fix issues on OPFSCoopSyncVFS where is an access handle failed to be obtained once, it could lock the entire connection indefinitely.

src/sqlite-api.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,11 @@ export function Factory(Module) {
898898
// Wait for all pending retry operations to complete. This is
899899
// normally empty on the first loop iteration.
900900
if (Module.retryOps.length) {
901-
await Promise.all(Module.retryOps);
902-
Module.retryOps = [];
901+
try {
902+
await Promise.all(Module.retryOps);
903+
} finally {
904+
Module.retryOps = [];
905+
}
903906
}
904907

905908
rc = await f();

0 commit comments

Comments
 (0)