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/thin-panthers-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/op-sqlite': patch
---

Silencing transactions that are reporting on failed rollback exceptions when they are safe to ignore.
26 changes: 9 additions & 17 deletions packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import {
BaseObserver,
DBAdapter,
DBAdapterListener,
DBLockOptions,
QueryResult,
Transaction
} from '@powersync/common';
import {
ANDROID_DATABASE_PATH,
getDylibPath,
IOS_LIBRARY_PATH,
open,
type DB
} from '@op-engineering/op-sqlite';
import { BaseObserver, DBAdapter, DBAdapterListener, DBLockOptions, QueryResult, Transaction } from '@powersync/common';
import { ANDROID_DATABASE_PATH, getDylibPath, IOS_LIBRARY_PATH, open, type DB } from '@op-engineering/op-sqlite';
import Lock from 'async-lock';
import { OPSQLiteConnection } from './OPSQLiteConnection';
import { Platform } from 'react-native';
Expand Down Expand Up @@ -283,7 +270,12 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
await commit();
return result;
} catch (ex) {
await rollback();
try {
await rollback();
} catch (ex2) {
// In rare cases, a rollback may fail.
// Safe to ignore.
}
throw ex;
}
}
Expand All @@ -292,7 +284,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
await this.initialized;
await this.writeConnection!.refreshSchema();

if(this.readConnections) {
if (this.readConnections) {
for (let readConnection of this.readConnections) {
await readConnection.connection.refreshSchema();
}
Expand Down
Loading