Update diesel-async (#4203)

* Update diesel-async

* Fix
This commit is contained in:
dullbananas 2023-11-27 02:31:19 -07:00 committed by GitHub
parent 7972dd0fcf
commit d95df3a46f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -99,7 +99,7 @@ activitypub_federation = { version = "0.5.0-beta.5", default-features = false, f
] }
diesel = "2.1.4"
diesel_migrations = "2.1.0"
diesel-async = "0.3.2"
diesel-async = "0.4.1"
serde = { version = "1.0.193", features = ["derive"] }
serde_with = "3.4.0"
actix-web = { version = "4.4.0", default-features = false, features = [

View file

@ -24,6 +24,7 @@ use diesel_async::{
pooled_connection::{
deadpool::{Object as PooledConnection, Pool},
AsyncDieselConnectionManager,
ManagerConfig,
},
};
use diesel_migrations::EmbeddedMigrations;
@ -291,7 +292,9 @@ pub async fn build_db_pool() -> Result<ActualDbPool, LemmyError> {
let manager = if tls_enabled {
// diesel-async does not support any TLS connections out of the box, so we need to manually
// provide a setup function which handles creating the connection
AsyncDieselConnectionManager::<AsyncPgConnection>::new_with_setup(&db_url, establish_connection)
let mut config = ManagerConfig::default();
config.custom_setup = Box::new(establish_connection);
AsyncDieselConnectionManager::<AsyncPgConnection>::new_with_config(&db_url, config)
} else {
AsyncDieselConnectionManager::<AsyncPgConnection>::new(&db_url)
};