File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
PowerSyncGRDB/Connections Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -71,12 +71,12 @@ final class SwiftSQLiteConnectionPoolAdapter: PowerSyncKotlin.SwiftPoolAdapter {
7171 // We currently only use this for schema updates
7272 return try await wrapExceptions {
7373 let sendableCallback = SendableAllLeaseCallback ( callback)
74- try await pool. write { lease in
74+ try await pool. withAllConnections { writer , readers in
7575 try sendableCallback. execute (
7676 writeLease: KotlinLeaseAdapter (
77- lease: lease
77+ lease: writer
7878 ) ,
79- readLeases: [ ]
79+ readLeases: readers . map { KotlinLeaseAdapter ( lease : $0 ) }
8080 )
8181 }
8282 }
Original file line number Diff line number Diff line change @@ -63,20 +63,20 @@ actor GRDBConnectionPool: SQLiteConnectionPoolProtocol {
6363 GRDBConnectionLease ( database: database)
6464 )
6565 }
66-
66+
6767 return sessionResult
6868 }
6969 // Notify PowerSync of these changes
7070 tableUpdatesContinuation? . yield ( result. affectedTables)
7171 // Notify GRDB, this needs to be a write (transaction)
72- try await pool. write { database in
72+ try await pool. write { database in
7373 // Notify GRDB about these changes
7474 for table in result. affectedTables {
7575 try database. notifyChanges ( in: Table ( table) )
7676 }
7777 }
7878
79- if case . failure( let error) = result. blockResult {
79+ if case let . failure( error) = result. blockResult {
8080 throw error
8181 }
8282 }
@@ -85,7 +85,7 @@ actor GRDBConnectionPool: SQLiteConnectionPoolProtocol {
8585 onConnection: @Sendable @escaping ( SQLiteConnectionLease, [ SQLiteConnectionLease] ) throws -> Void
8686 ) async throws {
8787 // FIXME, we currently don't support updating the schema
88- try await pool. write { database in
88+ try await pool. writeWithoutTransaction { database in
8989 let lease = try GRDBConnectionLease ( database: database)
9090 try onConnection ( lease, [ ] )
9191 }
You can’t perform that action at this time.
0 commit comments