[PR #2440] [MERGED] Database connection init #21291

Closed
opened 2026-04-30 07:50:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 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: mainHead: db-conn-init


📝 Commits (3)

  • b617ffd Add support for database connection init statements
  • 78d07e2 Add default connection-scoped pragmas for SQLite
  • 542a73c Switch 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 = 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, e.g.: #2436

  • 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 issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/2440 **Author:** [@jjlin](https://github.com/jjlin) **Created:** 4/27/2022 **Status:** ✅ Merged **Merged:** 5/11/2022 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `db-conn-init` --- ### 📝 Commits (3) - [`b617ffd`](https://github.com/dani-garcia/vaultwarden/commit/b617ffd2af71d81c24955c00c1f378325613dec0) Add support for database connection init statements - [`78d07e2`](https://github.com/dani-garcia/vaultwarden/commit/78d07e2fda8816fb41b91de2e84f8f4b3df8180e) Add default connection-scoped pragmas for SQLite - [`542a73c`](https://github.com/dani-garcia/vaultwarden/commit/542a73cc6edb4770755663df74b5e052019f425c) Switch to a single config option for database connection init ### 📊 Changes **3 files changed** (+57 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `.env.template` (+9 -0) 📝 `src/config.rs` (+4 -1) 📝 `src/db/mod.rs` (+44 -2) </details> ### 📄 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 = 5000`](https://www.sqlite.org/pragma.html#pragma_busy_timeout) 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, e.g.: #2436 * [`PRAGMA synchronous = NORMAL`](https://www.sqlite.org/pragma.html#pragma_synchronous) 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". --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 07:50:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#21291