File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
packages/web/src/db/adapters Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @powersync/web ' : patch
3+ ---
4+
5+ Use ` BEGIN EXCLUSIVE ` to open write transactions
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ export class LockedAsyncDatabaseAdapter
196196 }
197197
198198 writeTransaction < T > ( fn : ( tx : Transaction ) => Promise < T > , options ?: DBLockOptions | undefined ) : Promise < T > {
199- return this . writeLock ( this . wrapTransaction ( fn ) ) ;
199+ return this . writeLock ( this . wrapTransaction ( fn , true ) ) ;
200200 }
201201
202202 private generateDBHelpers <
@@ -240,9 +240,9 @@ export class LockedAsyncDatabaseAdapter
240240 /**
241241 * Wraps a lock context into a transaction context
242242 */
243- private wrapTransaction < T > ( cb : ( tx : Transaction ) => Promise < T > ) {
243+ private wrapTransaction < T > ( cb : ( tx : Transaction ) => Promise < T > , write = false ) {
244244 return async ( tx : LockContext ) : Promise < T > => {
245- await this . _execute ( 'BEGIN TRANSACTION ' ) ;
245+ await this . _execute ( write ? 'BEGIN EXCLUSIVE' : 'BEGIN ') ;
246246 let finalized = false ;
247247 const commit = async ( ) : Promise < QueryResult > => {
248248 if ( finalized ) {
You can’t perform that action at this time.
0 commit comments