chore(rust): gap-fill progress lines; slow-statement warning at 30 s
CI / Format & lint (push) Successful in 18s
CI / Test suite (push) Successful in 39s
Rust / fmt, clippy, test, build (push) Successful in 7m1s

This commit is contained in:
grabowski committed 2026-10-17 23:15:43 +07:00
1 parent 785836dcd8
commit 9b910c3cbf
5 files changed
+27 -3

No files matched your search

+8 -1
View File
@@ -15,10 +15,17 @@ use sqlx::postgres::PgPoolOptions;
use std::collections::{BTreeMap, HashMap, HashSet};
pub async fn connect(url: &str) -> Result<PgPool> {
use sqlx::ConnectOptions;
use std::str::FromStr;
// sqlx warns about any statement over 1 s; the whole-history gap scan
// legitimately takes several seconds on ~1M rows.
let options = sqlx::postgres::PgConnectOptions::from_str(url)
.context("invalid database URL")?
.log_slow_statements(log::LevelFilter::Warn, std::time::Duration::from_secs(30));
PgPoolOptions::new()
.max_connections(4)
.acquire_timeout(std::time::Duration::from_secs(30))
.connect(url)
.connect_with(options)
.await
.context("connecting to PostgreSQL")
}