Twenty database connections on Postgres, and a panel that does not cry wolf (#199, #200)

The Database connections panel drew idle connections as their own line, which
sits on the max for ten minutes after any burst and read as the pool maxing out,
while at most two were ever in use. It now draws in use against the max, with
open dashed behind them. The pool itself goes from sqlx's ten to twenty: the
server allows 100 and had about 13 open across every app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 20:27:21 +00:00
parent 8dc6dd4ce6
commit c28accb8e4
4 changed files with 16 additions and 10 deletions

View File

@@ -169,10 +169,9 @@ async fn connect(location: &str) -> Result<sea_orm::DatabaseConnection> {
// line for it at 50 requests a second (#136). In WAL readers run beside the one writer. Each
// transaction here writes first, so it takes the write lock or waits out the busy timeout for
// it; SQLite refuses at once only a transaction that read a snapshot a write has since moved
// past. Postgres keeps sqlx's ten.
if !is_postgres(location) {
opts.max_connections(8);
}
// past. Postgres gets twenty, where sqlx's ten filled in bursts: a page load asks for dozens
// of covers at once, each with a lookup (#200). The server allows 100, shared with other apps.
opts.max_connections(if is_postgres(location) { 20 } else { 8 });
sea_orm::Database::connect(opts)
.await
.with_context(|| format!("opening {}", redact(location)))