Fix pg pool options

This commit is contained in:
2024-12-24 20:05:27 +01:00
parent f4296d74ab
commit 5f95bfeee0

View File

@@ -4,7 +4,7 @@ use sqlx::{postgres::PgPoolOptions, PgPool};
pub async fn get_pg_pool() -> PgPool { pub async fn get_pg_pool() -> PgPool {
let database_url: String = format!( let database_url: String = format!(
"postgresql://{}:{}@{}:{}/{}?connection_limit=10&pool_timeout=300", "postgresql://{}:{}@{}:{}/{}",
CONFIG.postgres_user, CONFIG.postgres_user,
CONFIG.postgres_password, CONFIG.postgres_password,
CONFIG.postgres_host, CONFIG.postgres_host,
@@ -13,7 +13,8 @@ pub async fn get_pg_pool() -> PgPool {
); );
PgPoolOptions::new() PgPoolOptions::new()
.max_connections(5) .max_connections(10)
.acquire_timeout(std::time::Duration::from_secs(300))
.connect(&database_url) .connect(&database_url)
.await .await
.unwrap() .unwrap()