Add parameter for db pool size

This commit is contained in:
Tobias Reisinger 2024-05-10 18:03:02 +02:00
parent 9a87e502f7
commit 11e1a51a2a
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
2 changed files with 3 additions and 1 deletions

BIN
Cargo.lock generated

Binary file not shown.

View file

@ -27,7 +27,8 @@ async fn main() -> Result<(), std::io::Error> {
init_logging(&settings.logging.level)?; init_logging(&settings.logging.level)?;
let pool = emgauwa_common::db::init(&settings.database).await?; let pool_size = 10;
let pool = emgauwa_common::db::init(&settings.database, pool_size).await?;
let mut conn = pool.acquire().await.map_err(EmgauwaError::from)?; let mut conn = pool.acquire().await.map_err(EmgauwaError::from)?;
DbController::all_inactive(&mut conn) DbController::all_inactive(&mut conn)
@ -112,6 +113,7 @@ async fn main() -> Result<(), std::io::Error> {
.service(handlers::v1::ws::ws_relays), .service(handlers::v1::ws::ws_relays),
) )
}) })
.workers((pool_size / 2) as usize)
.listen(listener)? .listen(listener)?
.run() .run()
.await .await