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
This commit is contained in:
Nutomic 2024-01-04 18:16:51 +01:00 committed by GitHub
parent 38e64825e6
commit 7d9b59c467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -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.

View File

@ -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<Duration> = Some(Duration::from_secs(5));
pub const RANK_DEFAULT: f64 = 0.0001;
pub type ActualDbPool = Pool<AsyncPgConnection>;
@ -302,9 +301,6 @@ pub async fn build_db_pool() -> Result<ActualDbPool, LemmyError> {
};
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()?;

View File

@ -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,
}