From c8e7e0ee1ec6d95531d80ae77facfea1687381c6 Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 4 May 2026 17:54:28 -0700 Subject: [PATCH] WAL off default ENABLE_SQLITE_WAL_MODE to enable --- server/db/sqlite/driver.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/db/sqlite/driver.ts b/server/db/sqlite/driver.ts index 12681f521..0e50d1289 100644 --- a/server/db/sqlite/driver.ts +++ b/server/db/sqlite/driver.ts @@ -48,17 +48,18 @@ function autoFinalizeStatement( function createDb() { const sqlite = new Database(location); - // Enable WAL mode — allows concurrent readers + single writer, preventing - // contention across subsystems (verifySession, Traefik, audit, ping). - sqlite.pragma("journal_mode = WAL"); + if (process.env.ENABLE_SQLITE_WAL_MODE == "true") { + // Enable WAL mode — allows concurrent readers + single writer, preventing + // contention across subsystems (verifySession, Traefik, audit, ping). + sqlite.pragma("journal_mode = WAL"); + // NORMAL sync mode: safe with WAL, reduces write lock hold time. + sqlite.pragma("synchronous = NORMAL"); + } // Wait up to 5s on SQLITE_BUSY instead of failing — prevents audit log // retry loops that accumulate memory. sqlite.pragma("busy_timeout = 5000"); - // NORMAL sync mode: safe with WAL, reduces write lock hold time. - sqlite.pragma("synchronous = NORMAL"); - // 64 MB page cache (default 2 MB) — reduces I/O round-trips on large // TraefikConfigManager JOINs that block the event loop. sqlite.pragma("cache_size = -65536");