diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-13 14:10:54 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-13 14:10:54 -0500 |
| commit | 61ebcf0aeea6cfbdb70becf47bad38d001d8faa3 (patch) | |
| tree | 108c95ca7fb1b2b4588539169871f5fa5ee88155 | |
| parent | 54fba81956d1834a1e17fcfde47614d9ef617ad8 (diff) | |
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).
| -rw-r--r-- | Omni/Agent/Memory.hs | 2 |
1 files changed, 2 insertions, 0 deletions
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 |
