From 38026225348797302230a5e8a74dad78be96479c Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 10 Mar 2022 11:06:26 -0500 Subject: [PATCH] Wait for up to a second for existing database lock to clear This lets users queue new builds and otherwise schedule work while an ongoing run is proceeding (with lots of record-progress hits). Arguably we want to prioritize user-initiated commands to take effect and cancel ongoing record-progress operations (and other automated work), but that will need more care. --- src/db/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db/mod.rs b/src/db/mod.rs index 39c48ca6..26346b1a 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -19,6 +19,7 @@ struct ConnectionCustomizer; impl CustomizeConnection for ConnectionCustomizer { fn on_acquire(&self, conn: &mut Connection) -> Result<(), ::rusqlite::Error> { conn.execute("PRAGMA foreign_keys = ON;", [])?; + conn.execute("PRAGMA busy_timeout = 1000;", [])?; Ok(()) } }