From 7d9b59c4675fb0a5c3825daeae635549edfcb2fe Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 4 Jan 2024 18:16:51 +0100 Subject: [PATCH] Reduce default db pool size to 30, remove db timeout (ref #4282) (#4301) * Reduce default db pool size to 30 (ref #4282) * remove db timeout --- config/defaults.hjson | 2 +- crates/db_schema/src/utils.rs | 6 +----- crates/utils/src/settings/structs.rs | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/config/defaults.hjson b/config/defaults.hjson index 880af802c..b1c6d9ba5 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -34,7 +34,7 @@ # Name of the postgres database for lemmy database: "string" # Maximum number of active sql connections - pool_size: 95 + pool_size: 30 } # Settings related to activitypub federation # Pictrs image server configuration. diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index cb3d5d1ea..d7af17544 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -42,7 +42,7 @@ use rustls::{ use std::{ ops::{Deref, DerefMut}, sync::Arc, - time::{Duration, SystemTime}, + time::SystemTime, }; use tracing::{error, info}; use url::Url; @@ -51,7 +51,6 @@ const FETCH_LIMIT_DEFAULT: i64 = 10; pub const FETCH_LIMIT_MAX: i64 = 50; pub const SITEMAP_LIMIT: i64 = 50000; pub const SITEMAP_DAYS: i64 = 31; -const POOL_TIMEOUT: Option = Some(Duration::from_secs(5)); pub const RANK_DEFAULT: f64 = 0.0001; pub type ActualDbPool = Pool; @@ -302,9 +301,6 @@ pub async fn build_db_pool() -> Result { }; let pool = Pool::builder(manager) .max_size(SETTINGS.database.pool_size) - .wait_timeout(POOL_TIMEOUT) - .create_timeout(POOL_TIMEOUT) - .recycle_timeout(POOL_TIMEOUT) .runtime(Runtime::Tokio1) .build()?; diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index 886cd71b6..c4ff315ae 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -102,7 +102,7 @@ pub struct DatabaseConfig { pub(crate) connection: DatabaseConnection, /// Maximum number of active sql connections - #[default(95)] + #[default(30)] pub pool_size: usize, }