Add parameter for db pool size
This commit is contained in:
parent
9a87e502f7
commit
11e1a51a2a
2 changed files with 3 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -713,7 +713,6 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "emgauwa-common"
|
name = "emgauwa-common"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://git.serguzim.me/emgauwa/common.git#b14049b3f6e8aa6a748e4d185bd52ca3f7a38f38"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix",
|
"actix",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue