Skip to content

Commit dd2bce0

Browse files
committed
Fix race condition in closing.
1 parent dea8505 commit dd2bce0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/src/connection_pool.dart

+3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ class SqliteConnectionPool with SqliteQueries implements SqliteConnection {
191191
// Create a copy of the list, to avoid this triggering "Concurrent modification during iteration"
192192
final toClose = _readConnections.sublist(0);
193193
for (var connection in toClose) {
194+
// Wait for connection initialization, so that any existing readLock()
195+
// requests go through before closing.
196+
await connection.ready;
194197
await connection.close();
195198
}
196199
// Closing the write connection cleans up the journal files (-shm and -wal files).

0 commit comments

Comments
 (0)