1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-05-22 19:43:57 +00:00

Add default connection-scoped pragmas for SQLite

`PRAGMA busy_timeout = 5000` tells SQLite to keep trying for up to 5000 ms
when there is lock contention, rather than aborting immediately. This should
hopefully prevent the vast majority of "database is locked" panics observed
since the async transition.

`PRAGMA synchronous = NORMAL` trades better performance for a small potential
loss in durability (the default is `FULL`). The SQLite docs recommend `NORMAL`
as "a good choice for most applications running in WAL mode".
This commit is contained in:
Jeremy Lin 2022-04-26 17:55:19 -07:00
parent b617ffd2af
commit 78d07e2fda
2 changed files with 2 additions and 2 deletions

View file

@ -521,7 +521,7 @@ make_config! {
database_max_conns: u32, false, def, 10;
/// SQLite connection init |> Statements to run when creating a new SQLite connection
sqlite_conn_init: String, false, def, "".to_string();
sqlite_conn_init: String, false, def, "PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL;".to_string();
/// MySQL connection init |> Statements to run when creating a new MySQL connection
mysql_conn_init: String, false, def, "".to_string();