Skip to content

Commit 96bfaca

Browse files
author
Kevin Hopper
committed
Switch SQLite to WAL mode and increase busy_timeout to 30s
WAL (Write-Ahead Logging) allows concurrent readers alongside a single writer, eliminating SQLITE_BUSY errors in multi-process deployments (gateway + MCP servers + Claude Code). Previously used delete journal mode where any writer blocked all readers. busy_timeout increased from 5s to 30s as a safety net for the rare case where write contention still occurs under WAL.
1 parent 1c60b51 commit 96bfaca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

servers/db.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ export async function ensureColumn(db, table, column, type) {
127127
export function createDbClient(dbPath) {
128128
const filePath = dbPath || process.env.CROW_DB_PATH || resolve(resolveDataDir(), "crow.db");
129129
const client = createClient({ url: `file:${filePath}` });
130-
client.execute("PRAGMA busy_timeout = 5000").catch(err =>
130+
client.execute("PRAGMA journal_mode = WAL").catch(err =>
131+
console.warn("[db] Failed to set WAL mode:", err.message)
132+
);
133+
client.execute("PRAGMA busy_timeout = 30000").catch(err =>
131134
console.warn("[db] Failed to set busy_timeout:", err.message)
132135
);
133136
return client;

0 commit comments

Comments
 (0)