fix: resolve issues with max connections to db
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/push/publish-docs Pipeline was successful

This might need tweaking elsewhere, needs more testing to figure out where faults are happening
This commit is contained in:
Radical 2025-07-11 03:06:47 +02:00
parent 2013befda2
commit 1a0fefd364
2 changed files with 8 additions and 11 deletions

View file

@ -7,7 +7,7 @@ use diesel_async::pooled_connection::deadpool::Pool;
use error::Error;
use objects::MailClient;
use simple_logger::SimpleLogger;
use std::time::{Duration, SystemTime};
use std::time::SystemTime;
mod config;
use config::{Config, ConfigBuilder};
use diesel_migrations::{EmbeddedMigrations, MigrationHarness, embed_migrations};
@ -61,12 +61,7 @@ async fn main() -> Result<(), Error> {
// create a new connection pool with the default config
let pool_config =
AsyncDieselConnectionManager::<diesel_async::AsyncPgConnection>::new(config.database.url());
// FIXME: Don't manually set max size and instead fix underlying connection issues
let pool = Pool::builder(pool_config)
.max_size(50)
//.wait_timeout(Some(Duration::from_secs(5)))
//.recycle_timeout(Some(Duration::from_secs(5)))
.build()?;
let pool = Pool::builder(pool_config).build()?;
let cache_pool = redis::Client::open(config.cache_database.url())?;

View file

@ -131,11 +131,13 @@ impl Member {
.await,
)?;
let member_futures = member_builders
.iter()
.map(async move |m| m.build(data, Some(me)).await);
let mut members = vec![];
futures::future::try_join_all(member_futures).await
for builder in member_builders {
members.push(builder.build(&data, Some(me)).await?);
}
Ok(members)
}
pub async fn new(data: &Data, user_uuid: Uuid, guild_uuid: Uuid) -> Result<Self, Error> {