Skip to content

Commit

Permalink
Bump diesel-async from 0.3.2 to 0.4.1 (#126)
Browse files Browse the repository at this point in the history
* Bump diesel-async from 0.3.2 to 0.4.1

Bumps [diesel-async](https://github.com/weiznich/diesel_async) from 0.3.2 to 0.4.1.
- [Release notes](https://github.com/weiznich/diesel_async/releases)
- [Changelog](https://github.com/weiznich/diesel_async/blob/main/CHANGELOG.md)
- [Commits](weiznich/diesel_async@v0.3.2...v0.4.1)

---
updated-dependencies:
- dependency-name: diesel-async
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fixes for diesel-async update

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Naim A <[email protected]>
  • Loading branch information
dependabot[bot] and naim94a authored Jan 13, 2024
1 parent 68775f0 commit b28fb09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ binascii = "0.1"
tokio-postgres = {version = "0.7", default-features = false, optional = true}
diesel = {version = "2.1", optional = true, default-features = false, features = ["postgres_backend", "time"]}
time = {version = "0.3.31", optional = true}
diesel-async = {version = "0.3", optional = true, features = ["postgres", "bb8"]}
diesel-async = {version = "0.4.1", optional = true, features = ["postgres", "bb8"]}
anyhow = "1.0"
prometheus-client = "0.22.0"

Expand Down
6 changes: 4 additions & 2 deletions common/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod schema_auto;
pub mod schema;

use diesel::{upsert::excluded, ExpressionMethods, QueryDsl, NullableExpressionMethods, sql_types::{Array, Binary, VarChar, Integer}, query_builder::{QueryFragment, Query}};
use diesel_async::RunQueryDsl;
use diesel_async::{RunQueryDsl, pooled_connection::ManagerConfig};

pub type DynConfig = dyn crate::config::HasConfig + Send + Sync;

Expand Down Expand Up @@ -79,7 +79,8 @@ impl Database {
}

async fn make_bb8_pool(db_url: &str, tls: Option<MakeTlsConnector>) -> Result<diesel_async::pooled_connection::bb8::Pool<diesel_async::AsyncPgConnection>, anyhow::Error> {
let cfg = diesel_async::pooled_connection::AsyncDieselConnectionManager::<diesel_async::AsyncPgConnection>::new_with_setup(db_url, move |db_url| {
let mut config = ManagerConfig::default();
config.custom_setup = Box::new(move |db_url| {
let tls = tls.clone();
Box::pin(async move {
if let Some(tls) = tls {
Expand All @@ -89,6 +90,7 @@ impl Database {
}
})
});
let cfg = diesel_async::pooled_connection::AsyncDieselConnectionManager::<diesel_async::AsyncPgConnection>::new_with_config(db_url, config);

let pool = diesel_async::pooled_connection::bb8::Pool::builder()
.min_idle(Some(1))
Expand Down

0 comments on commit b28fb09

Please sign in to comment.