Skip to content

Commit

Permalink
[Fix] Double rollback calls in transactions (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriztiaan committed Jul 11, 2024
1 parent f60fbed commit 8d5b702
Show file tree
Hide file tree
Showing 5 changed files with 17,266 additions and 22,013 deletions.
5 changes: 5 additions & 0 deletions .changeset/new-melons-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/web': patch
---

Silencing transactions that are reporting on failed rollback exceptions when they are safe to ignore.
5 changes: 5 additions & 0 deletions .changeset/red-jobs-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/react-native': patch
---

Updated dependencies
4 changes: 2 additions & 2 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"homepage": "https://docs.powersync.com/",
"peerDependencies": {
"@journeyapps/react-native-quick-sqlite": "^1.1.6",
"@journeyapps/react-native-quick-sqlite": "^1.1.8",
"react": "*",
"react-native": "*",
"react-native-polyfill-globals": "^3.1.0",
Expand All @@ -41,7 +41,7 @@
"react-native-fetch-api": "^3.0.0"
},
"devDependencies": {
"@journeyapps/react-native-quick-sqlite": "^1.1.6",
"@journeyapps/react-native-quick-sqlite": "^1.1.8",
"@types/async-lock": "^1.4.0",
"react": "18.2.0",
"react-native": "0.72.4",
Expand Down
7 changes: 6 additions & 1 deletion packages/web/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ export class WASQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
return result;
} catch (ex) {
this.logger.debug('Caught ex in transaction', ex);
await rollback();
try {
await rollback();
} catch (ex2) {
// In rare cases, a rollback may fail.
// Safe to ignore.
}
throw ex;
}
};
Expand Down
Loading

0 comments on commit 8d5b702

Please sign in to comment.