feat: added pg connection lifetime
This commit is contained in:
parent
1a7866e651
commit
f787c32a62
|
|
@ -338,6 +338,8 @@ async fn get_connection_pool(setting: &DatabaseSetting) -> Result<PgPool, Error>
|
|||
PgPoolOptions::new()
|
||||
.max_connections(setting.max_connections)
|
||||
.acquire_timeout(Duration::from_secs(10))
|
||||
.max_lifetime(Duration::from_secs(60 * 60))
|
||||
.idle_timeout(Duration::from_secs(60))
|
||||
.connect_with(setting.with_db())
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("Failed to connect to postgres database: {}", e))
|
||||
|
|
|
|||
Loading…
Reference in New Issue