mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
wallet: set a timeout if the db is busy.
This is recommended for litestream, which allows for easy async backup, and harmless otherwise. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Changed: db: we now set a busy timeout to safely allow others to access sqlite3 db (e.g. litestream)
This commit is contained in:
parent
c066378576
commit
5bf2b5c0ba
1 changed files with 5 additions and 0 deletions
|
@ -43,6 +43,11 @@ static bool db_sqlite3_setup(struct db *db)
|
|||
}
|
||||
db->conn = sql;
|
||||
|
||||
/* In case another writer (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);
|
||||
|
||||
sqlite3_prepare_v2(db->conn, "PRAGMA foreign_keys = ON;", -1, &stmt, NULL);
|
||||
err = sqlite3_step(stmt);
|
||||
sqlite3_finalize(stmt);
|
||||
|
|
Loading…
Add table
Reference in a new issue