mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-23 00:25:37 -05:00
[PR #2440] [MERGED] Database connection init #11957
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/2440
Author: @jjlin
Created: 4/27/2022
Status: ✅ Merged
Merged: 5/11/2022
Merged by: @dani-garcia
Base:
main← Head:db-conn-init📝 Commits (3)
b617ffdAdd support for database connection init statements78d07e2Add default connection-scoped pragmas for SQLite542a73cSwitch to a single config option for database connection init📊 Changes
3 files changed (+57 additions, -3 deletions)
View changed files
📝
.env.template(+9 -0)📝
src/config.rs(+4 -1)📝
src/db/mod.rs(+44 -2)📄 Description
Adds support for database connection init statements. This is probably mainly useful for running connection-scoped pragma statements.
Also adds default connection-scoped pragmas for SQLite:
PRAGMA busy_timeout = 5000tells 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, e.g.: #2436PRAGMA synchronous = NORMALtrades better performance for a small potential loss in durability (the default isFULL). The SQLite docs recommendNORMALas "a good choice for most applications running in WAL mode".🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.