mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 06:35:38 +01:00
Fix pg pool options
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user