From ab026fb4de0c8177c61826a61e275358837697e3 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj jxPCSnmZ Date: Sun, 17 Oct 2021 06:29:27 +0800 Subject: [PATCH] wallet/db_sqlite3.c: Increase busy timeout to 60 seconds. Closes: #4860 ChangeLog-Added: With `sqlite3` db backend we now use a 60-second busy timer, to allow backup processes like `litestream` to operate safely. --- wallet/db_sqlite3.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wallet/db_sqlite3.c b/wallet/db_sqlite3.c index f5e065cf6..6ff339ffe 100644 --- a/wallet/db_sqlite3.c +++ b/wallet/db_sqlite3.c @@ -41,10 +41,13 @@ static bool db_sqlite3_setup(struct db *db) } db->conn = sql; - /* In case another writer (litestream?) grabs a lock, we don't + /* In case another process (litestream?) grabs a lock, we don't * want to return SQLITE_BUSY immediately (which will cause a - * fatal error): give it 5 seconds. */ - sqlite3_busy_timeout(db->conn, 5000); + * fatal error): give it 60 seconds. + * We *could* make this an option, but surely the user prefers a + * long timeout over an outright crash. + */ + sqlite3_busy_timeout(db->conn, 60000); sqlite3_prepare_v2(db->conn, "PRAGMA foreign_keys = ON;", -1, &stmt, NULL); err = sqlite3_step(stmt);