* Reduce default db pool size to 30 (ref #4282) * remove db timeout
This commit is contained in:
parent
38e64825e6
commit
7d9b59c467
3 changed files with 3 additions and 7 deletions
|
@ -34,7 +34,7 @@
|
||||||
# Name of the postgres database for lemmy
|
# Name of the postgres database for lemmy
|
||||||
database: "string"
|
database: "string"
|
||||||
# Maximum number of active sql connections
|
# Maximum number of active sql connections
|
||||||
pool_size: 95
|
pool_size: 30
|
||||||
}
|
}
|
||||||
# Settings related to activitypub federation
|
# Settings related to activitypub federation
|
||||||
# Pictrs image server configuration.
|
# Pictrs image server configuration.
|
||||||
|
|
|
@ -42,7 +42,7 @@ use rustls::{
|
||||||
use std::{
|
use std::{
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::{Duration, SystemTime},
|
time::SystemTime,
|
||||||
};
|
};
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -51,7 +51,6 @@ const FETCH_LIMIT_DEFAULT: i64 = 10;
|
||||||
pub const FETCH_LIMIT_MAX: i64 = 50;
|
pub const FETCH_LIMIT_MAX: i64 = 50;
|
||||||
pub const SITEMAP_LIMIT: i64 = 50000;
|
pub const SITEMAP_LIMIT: i64 = 50000;
|
||||||
pub const SITEMAP_DAYS: i64 = 31;
|
pub const SITEMAP_DAYS: i64 = 31;
|
||||||
const POOL_TIMEOUT: Option<Duration> = Some(Duration::from_secs(5));
|
|
||||||
pub const RANK_DEFAULT: f64 = 0.0001;
|
pub const RANK_DEFAULT: f64 = 0.0001;
|
||||||
|
|
||||||
pub type ActualDbPool = Pool<AsyncPgConnection>;
|
pub type ActualDbPool = Pool<AsyncPgConnection>;
|
||||||
|
@ -302,9 +301,6 @@ pub async fn build_db_pool() -> Result<ActualDbPool, LemmyError> {
|
||||||
};
|
};
|
||||||
let pool = Pool::builder(manager)
|
let pool = Pool::builder(manager)
|
||||||
.max_size(SETTINGS.database.pool_size)
|
.max_size(SETTINGS.database.pool_size)
|
||||||
.wait_timeout(POOL_TIMEOUT)
|
|
||||||
.create_timeout(POOL_TIMEOUT)
|
|
||||||
.recycle_timeout(POOL_TIMEOUT)
|
|
||||||
.runtime(Runtime::Tokio1)
|
.runtime(Runtime::Tokio1)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub struct DatabaseConfig {
|
||||||
pub(crate) connection: DatabaseConnection,
|
pub(crate) connection: DatabaseConnection,
|
||||||
|
|
||||||
/// Maximum number of active sql connections
|
/// Maximum number of active sql connections
|
||||||
#[default(95)]
|
#[default(30)]
|
||||||
pub pool_size: usize,
|
pub pool_size: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue