Fix deadlock in SqliteStore

- If setup wasnt called separately _cursor() and setup() would deadlock
- The call to setup() in _cursor() should be outside the lock block, as setup() also acquires the lock and re-checks the setup flag
This commit is contained in:
Nuno Campos
2025-06-27 08:57:35 -07:00
parent 96bfc8bad9
commit c406aede96
2 changed files with 6 additions and 8 deletions
@@ -223,10 +223,9 @@ class AsyncSqliteStore(AsyncBatchedBaseStore, BaseSqliteStore):
Yields:
An SQLite cursor object.
"""
if not self.is_setup:
await self.setup()
async with self.lock:
if not self.is_setup:
await self.setup()
if transaction:
await self.conn.execute("BEGIN")