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:
@@ -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?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user