Skip to content

Commit

Permalink
wallet/db_sqlite3.c: Increase busy timeout to 60 seconds.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ZmnSCPxj committed Oct 17, 2021
1 parent c012a71 commit ab026fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wallet/db_sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ab026fb

Please sign in to comment.