1
0

feat: enable SQLite WAL mode for all databases (AGI ticket #1) (#153)

This commit is contained in:
Alexander Whitestone
2026-03-08 16:07:02 -04:00
committed by GitHub
parent 11ba21418a
commit 82fb2417e3
31 changed files with 1042 additions and 170 deletions

View File

@@ -93,16 +93,19 @@ class UnifiedMemory:
conn = sqlite3.connect(str(self.db_path))
try:
conn.execute("PRAGMA journal_mode=WAL")
conn.execute("PRAGMA busy_timeout=5000")
conn.executescript(_LOCAL_SCHEMA)
conn.commit()
logger.info("Brain local DB initialized at %s", self.db_path)
logger.info("Brain local DB initialized at %s (WAL mode)", self.db_path)
finally:
conn.close()
def _get_conn(self) -> sqlite3.Connection:
"""Get a SQLite connection."""
"""Get a SQLite connection with WAL mode and busy timeout."""
conn = sqlite3.connect(str(self.db_path))
conn.row_factory = sqlite3.Row
conn.execute("PRAGMA busy_timeout=5000")
return conn
def _get_embedder(self):