mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-11 20:27:54 +02:00
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:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user