File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
PowerSyncGRDB/Connections Expand file tree Collapse file tree 2 files changed +10
-6
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,25 +63,29 @@ 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 }
78+
79+ if case let . failure( error) = result. blockResult {
80+ throw error
81+ }
7882 }
7983
8084 func withAllConnections(
8185 onConnection: @Sendable @escaping ( SQLiteConnectionLease, [ SQLiteConnectionLease] ) throws -> Void
8286 ) async throws {
8387 // FIXME, we currently don't support updating the schema
84- try await pool. write { database in
88+ try await pool. writeWithoutTransaction { database in
8589 let lease = try GRDBConnectionLease ( database: database)
8690 try onConnection ( lease, [ ] )
8791 }
You can’t perform that action at this time.
0 commit comments