File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,15 @@ export type OnTableChangeCallback = (event: BatchedUpdateNotification) => void;
2525export interface AsyncDatabaseConnection < Config extends ResolvedWebSQLOpenOptions = ResolvedWebSQLOpenOptions > {
2626 init ( ) : Promise < void > ;
2727 close ( ) : Promise < void > ;
28+ /**
29+ * Marks the connection as in-use by a certain actor.
30+ * @returns A hold ID which can be used to release the hold.
31+ */
2832 markHold ( ) : Promise < string > ;
33+ /**
34+ * Releases a hold on the connection.
35+ * @param holdId The hold ID to release.
36+ */
2937 releaseHold ( holdId : string ) : Promise < void > ;
3038 execute ( sql : string , params ?: any [ ] ) : Promise < ProxiedQueryResult > ;
3139 executeRaw ( sql : string , params ?: any [ ] ) : Promise < any [ ] [ ] > ;
Original file line number Diff line number Diff line change @@ -80,12 +80,11 @@ export class SharedWASQLiteConnection implements AsyncDatabaseConnection {
8080 clientIds . delete ( clientId ) ;
8181
8282 if ( this . activeHoldId ) {
83- /**
84- * The hold hasn't been released, but we're closing now.
85- * We can proactively cleanup and release the hold.
86- */
87- await this . connection . execute ( 'ROLLBACK' ) . catch ( ( ) => { } ) ;
88- await this . connection . releaseHold ( this . activeHoldId ) . catch ( ( ) => { } ) ;
83+ // We can't cleanup here since we're not in a lock context.
84+ // The cleanup will occur once a new hold is acquired.
85+ this . logger . info (
86+ `Hold ${ this . activeHoldId } was still active when the connection was closed. Cleanup will occur once a new hold is acquired.`
87+ ) ;
8988 }
9089
9190 if ( clientIds . size == 0 ) {
You can’t perform that action at this time.
0 commit comments