Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(store): set busy_timeout before journal_mode=WAL to prevent immediate SQLITE_BUSY on lock contention

Shane McCarron804d680c0d5a
diff --git a/src/store/store.c b/src/store/store.c
index 4b00d4e73..bf3519161 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;
}