Skip to content

Commit 9284734

Browse files
committed
fix(powersync): use read lock for BucketStorage.select()
BucketStorage.select() is documented for read statements only, but called _internalDb.execute(), which acquires a write lock. All callers run SELECTs, so route them through getAll() to take a read lock instead. This avoids serializing read-only queries behind the write lock (e.g. on web with SqliteConnectionPool). Closes #384
1 parent 231a3e9 commit 9284734

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/powersync/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.3.1 (unreleased)
2+
3+
- Fix `BucketStorage.select()` acquiring a write lock for read-only queries by using `getAll()` instead of `execute()`.
4+
15
## 2.3.0
26

37
- Add `SyncOptions.httpClient` to `SyncOptions`. It can be set to make PowerSync use a custom HTTP client when connecting to the PowerSync Service.

packages/powersync/lib/src/sync/bucket_storage.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BucketStorage {
1818
// Use only for read statements
1919
Future<ResultSet> select(String query,
2020
[List<Object?> parameters = const []]) async {
21-
return await _internalDb.execute(query, parameters);
21+
return await _internalDb.getAll(query, parameters);
2222
}
2323

2424
Future<String> getClientId() async {

0 commit comments

Comments
 (0)