Skip to main content

connect_postgres

Function connect_postgres 

Source
pub async fn connect_postgres(url: &str) -> Result<PgPool, Error>
Expand description

Open a Postgres pool from a URL with umbral’s pool configuration.

PERF-5 / gaps2 #91: bare PgPool::connect uses sqlx’s defaults with no acquire timeout, so a saturated pool blocks request tasks forever. We always apply the full set of pool knobs — max_connections, min_connections, a bounded acquire_timeout (fail fast), idle_timeout, max_lifetime, and test_before_acquire — read from crate::settings when available (falling back to the documented production defaults if the pool is opened before settings are installed). idle_timeout/max_lifetime are only applied when Some; a None (env 0/empty) leaves that recycling disabled.