From 804d680c0d5a59d1704c5a5bd2c3a51510dc102a Mon Sep 17 00:00:00 2001 From: Shane McCarron Date: Sun, 22 Mar 2026 14:42:03 -0500 Subject: [PATCH] fix(store): set busy_timeout before journal_mode=WAL to prevent immediate SQLITE_BUSY on lock contention Co-Authored-By: Claude Sonnet 4.6 --- src/store/store.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/store.c b/src/store/store.c index 4b00d4e7..bf351916 100644 --- a/src/store/store.c +++ b/src/store/store.c @@ -229,15 +229,15 @@ static int configure_pragmas(cbm_store_t *s, bool in_memory) { if (in_memory) { rc = exec_sql(s, "PRAGMA synchronous = OFF;"); } else { - rc = exec_sql(s, "PRAGMA journal_mode = WAL;"); + rc = exec_sql(s, "PRAGMA busy_timeout = 10000;"); if (rc != CBM_STORE_OK) { return rc; } - rc = exec_sql(s, "PRAGMA synchronous = NORMAL;"); + rc = exec_sql(s, "PRAGMA journal_mode = WAL;"); if (rc != CBM_STORE_OK) { return rc; } - rc = exec_sql(s, "PRAGMA busy_timeout = 10000;"); + rc = exec_sql(s, "PRAGMA synchronous = NORMAL;"); if (rc != CBM_STORE_OK) { return rc; }