fix: size the DB pool and fail fast on saturation
The single Postgres pool (shared by HTTP handlers and the crawler/analysis daemons) hardcoded max_connections=10 with no acquire_timeout, so under saturation callers hung on the driver's silent 30s default. Add a DbConfig (DB_MAX_CONNECTIONS default 20, DB_ACQUIRE_TIMEOUT_SECS default 10, clamped to >=1) and apply both in PgPoolOptions. Bump to 0.124.4. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -279,7 +279,8 @@ impl DaemonReloader for Supervisors {
|
||||
|
||||
pub async fn build(config: Config) -> anyhow::Result<AppHandle> {
|
||||
let db = PgPoolOptions::new()
|
||||
.max_connections(10)
|
||||
.max_connections(config.db.max_connections)
|
||||
.acquire_timeout(config.db.acquire_timeout)
|
||||
.connect(&config.database_url)
|
||||
.await?;
|
||||
sqlx::migrate!("./migrations").run(&db).await?;
|
||||
|
||||
Reference in New Issue
Block a user