fix: add 5s pool acquire_timeout to prevent connection starvation cascade

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-03-11 22:47:51 +00:00
co-authored by Claude Opus 4.6
parent 2aef01d18c
commit 56b9bc64f7
+1
View File
@@ -105,6 +105,7 @@ pub async fn connect(
let mut pool_options = sqlx::postgres::PgPoolOptions::new()
.min_connections((max_connections / 5).clamp(1, max_connections))
.max_connections(max_connections)
.acquire_timeout(Duration::from_secs(5))
.max_lifetime(Duration::from_secs(30 * 60)); // 30 mins
if worker_mode {
pool_options = pool_options.idle_timeout(Duration::from_secs(60));