Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Close SQLite connexion even if error

Clémence Lesné54f9893f144b
diff --git a/persistence/sqlite.py b/persistence/sqlite.py
index eea6458..09a62f0 100644
--- a/persistence/sqlite.py
+++ b/persistence/sqlite.py
@@ -132,7 +132,10 @@ class SqliteStore(IStore):
first_run = True
# Connect to DB
- async with sqlite_connect(database=db_path) as db:
+ db = sqlite_connect(database=db_path)
+ try:
if first_run:
await self._init_db(db)
yield db
+ finally:
+ await db.close()