From 118bd6904c384837de57e7c91d245111980053b7 Mon Sep 17 00:00:00 2001 From: Cameron Cordes Date: Tue, 3 Nov 2026 14:41:55 -0500 Subject: [PATCH] fix(reembed): set a busy timeout so it can run beside the live server The tool opened a bare connection, so an UPDATE that met the server's watcher holding the write lock failed at once (SQLITE_BUSY) and aborted the whole run. Wait up to 15 s instead, like the server's own pool. Co-Authored-By: Claude Opus 5.5 --- src/bin/reembed_embeddings.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/reembed_embeddings.rs b/src/bin/reembed_embeddings.rs index ba2a4f0..94c8d63 100644 --- a/src/bin/reembed_embeddings.rs +++ b/src/bin/reembed_embeddings.rs @@ -286,6 +286,13 @@ async fn main() -> Result<()> { let mut conn = SqliteConnection::establish(&database_url) .with_context(|| format!("connecting to {}", database_url))?; + // Run beside the live server: its watcher writes the same file, and + // without a busy timeout one contended UPDATE fails the whole run. + { + use diesel::connection::SimpleConnection; + conn.batch_execute("PRAGMA busy_timeout = 15000;") + .context("setting busy_timeout")?; + } // This tool exists to move the corpus to the configured contract, so it // embeds even while the stored one differs (#189). -- 2.54.0