feat(server): configurable DB pool size via --db-max-connections/DB_MAX_CONNECTIONS (#2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 21:46:41 +02:00
parent 7e235ffd3e
commit 7181437625
4 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -17,10 +17,11 @@ pub struct Db {
}
impl Db {
/// Connect to the database at `database_url`, opening a connection pool.
pub async fn connect(database_url: &str) -> Result<Self, sqlx::Error> {
/// Connect to the database at `database_url`, opening a connection pool with at most
/// `max_connections` connections.
pub async fn connect(database_url: &str, max_connections: u32) -> Result<Self, sqlx::Error> {
let pool = PgPoolOptions::new()
.max_connections(5)
.max_connections(max_connections)
.connect(database_url)
.await?;