mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-08-27 04:54:47 +00:00
Merge 5964baa72c
into 1f73630136
This commit is contained in:
commit
f291f19a74
2 changed files with 9 additions and 1 deletions
|
@ -639,9 +639,15 @@ make_config! {
|
|||
/// Timeout when acquiring database connection
|
||||
database_timeout: u64, false, def, 30;
|
||||
|
||||
/// Database connection pool size
|
||||
/// Timeout in seconds before idle connections to the database are closed
|
||||
database_idle_timeout: u64, false, def, 60;
|
||||
|
||||
/// Database connection max pool size
|
||||
database_max_conns: u32, false, def, 10;
|
||||
|
||||
/// Database connection min pool size
|
||||
database_min_conns: u32, false, def, 2;
|
||||
|
||||
/// Database connection init |> SQL statements to run when creating a new database connection, mainly useful for connection-scoped pragmas. If empty, a database-specific default is used.
|
||||
database_conn_init: String, false, def, String::new();
|
||||
|
||||
|
|
|
@ -134,6 +134,8 @@ macro_rules! generate_connections {
|
|||
let manager = ConnectionManager::new(&url);
|
||||
let pool = Pool::builder()
|
||||
.max_size(CONFIG.database_max_conns())
|
||||
.min_idle(Some(CONFIG.database_min_conns()))
|
||||
.idle_timeout(Some(Duration::from_secs(CONFIG.database_idle_timeout())))
|
||||
.connection_timeout(Duration::from_secs(CONFIG.database_timeout()))
|
||||
.connection_customizer(Box::new(DbConnOptions{
|
||||
init_stmts: conn_type.get_init_stmts()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue