From 61ebcf0aeea6cfbdb70becf47bad38d001d8faa3 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 13 Dec 2025 14:10:54 -0500 Subject: Enable WAL mode and busy timeout for SQLite concurrency Fixes 'database is locked' errors when multiple threads access the memory database simultaneously (incoming batcher, message dispatch, reminder loop, main handler). --- Omni/Agent/Memory.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Omni') diff --git a/Omni/Agent/Memory.hs b/Omni/Agent/Memory.hs index 9ca2d99..0f481b6 100644 --- a/Omni/Agent/Memory.hs +++ b/Omni/Agent/Memory.hs @@ -586,6 +586,8 @@ withMemoryDb action = do -- | Initialize the memory database schema. initMemoryDb :: SQL.Connection -> IO () initMemoryDb conn = do + SQL.execute_ conn "PRAGMA journal_mode = WAL" + SQL.execute_ conn "PRAGMA busy_timeout = 5000" SQL.execute_ conn "PRAGMA foreign_keys = ON" SQL.execute_ conn -- cgit v1.2.3