fix: resolve issues with max connections to db
This might need tweaking elsewhere, needs more testing to figure out where faults are happening
This commit is contained in:
parent
2013befda2
commit
1a0fefd364
2 changed files with 8 additions and 11 deletions
|
@ -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())?;
|
||||
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue