From c482d59661f8df7e956f645e92e4dd11e58e26e8 Mon Sep 17 00:00:00 2001 From: Randolf Jung Date: Thu, 2 May 2024 13:28:04 +0200 Subject: [PATCH] Update `deadpool` to `0.11` --- Cargo.toml | 62 +++++++++++++++++++++++-------- src/pooled_connection/deadpool.rs | 5 +-- 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 22a4a7d..bc78732 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,30 +13,52 @@ description = "An async extension for Diesel the safe, extensible ORM and Query rust-version = "1.65.0" [dependencies] -diesel = { version = "~2.1.1", default-features = false, features = ["i-implement-a-third-party-backend-and-opt-into-breaking-changes"]} +diesel = { version = "~2.1.1", default-features = false, features = [ + "i-implement-a-third-party-backend-and-opt-into-breaking-changes", +] } async-trait = "0.1.66" -futures-channel = { version = "0.3.17", default-features = false, features = ["std", "sink"], optional = true } -futures-util = { version = "0.3.17", default-features = false, features = ["std", "sink"] } -tokio-postgres = { version = "0.7.10", optional = true} -tokio = { version = "1.26", optional = true} -mysql_async = { version = ">=0.30.0,<0.34", optional = true, default-features = false, features = ["minimal", "derive"] } -mysql_common = {version = ">=0.29.0,<0.32.0", optional = true, default-features = false, features = ["frunk", "derive"]} +futures-channel = { version = "0.3.17", default-features = false, features = [ + "std", + "sink", +], optional = true } +futures-util = { version = "0.3.17", default-features = false, features = [ + "std", + "sink", +] } +tokio-postgres = { version = "0.7.10", optional = true } +tokio = { version = "1.26", optional = true } +mysql_async = { version = ">=0.30.0,<0.34", optional = true, default-features = false, features = [ + "minimal", + "derive", +] } +mysql_common = { version = ">=0.29.0,<0.32.0", optional = true, default-features = false, features = [ + "frunk", + "derive", +] } -bb8 = {version = "0.8", optional = true} -deadpool = {version = "0.10", optional = true, default-features = false, features = ["managed"] } -mobc = {version = ">=0.7,<0.10", optional = true} -scoped-futures = {version = "0.1", features = ["std"]} +bb8 = { version = "0.8", optional = true } +deadpool = { version = "0.11", optional = true, default-features = false, features = [ + "managed", +] } +mobc = { version = ">=0.7,<0.10", optional = true } +scoped-futures = { version = "0.1", features = ["std"] } [dev-dependencies] -tokio = {version = "1.12.0", features = ["rt", "macros", "rt-multi-thread"]} +tokio = { version = "1.12.0", features = ["rt", "macros", "rt-multi-thread"] } cfg-if = "1" chrono = "0.4" -diesel = { version = "2.1.0", default-features = false, features = ["chrono"]} +diesel = { version = "2.1.0", default-features = false, features = ["chrono"] } diesel_migrations = "2.1.0" [features] default = [] -mysql = ["diesel/mysql_backend", "mysql_async", "mysql_common", "futures-channel", "tokio"] +mysql = [ + "diesel/mysql_backend", + "mysql_async", + "mysql_common", + "futures-channel", + "tokio", +] postgres = ["diesel/postgres_backend", "tokio-postgres", "tokio", "tokio/rt"] sqlite = ["diesel/sqlite", "sync-connection-wrapper"] sync-connection-wrapper = ["tokio/rt"] @@ -49,7 +71,17 @@ path = "tests/lib.rs" harness = true [package.metadata.docs.rs] -features = ["postgres", "mysql", "sqlite", "deadpool", "bb8", "mobc", "async-connection-wrapper", "sync-connection-wrapper", "r2d2"] +features = [ + "postgres", + "mysql", + "sqlite", + "deadpool", + "bb8", + "mobc", + "async-connection-wrapper", + "sync-connection-wrapper", + "r2d2", +] no-default-features = true rustc-args = ["--cfg", "doc_cfg"] rustdoc-args = ["--cfg", "doc_cfg"] diff --git a/src/pooled_connection/deadpool.rs b/src/pooled_connection/deadpool.rs index 33b843f..d8d2b89 100644 --- a/src/pooled_connection/deadpool.rs +++ b/src/pooled_connection/deadpool.rs @@ -65,7 +65,6 @@ pub type Hook = deadpool::managed::Hook>; /// Type alias for using [`deadpool::managed::HookError`] with [`diesel-async`] pub type HookError = deadpool::managed::HookError; -#[async_trait::async_trait] impl Manager for AsyncDieselConnectionManager where C: PoolableConnection + Send + 'static, @@ -89,8 +88,8 @@ where _: &deadpool::managed::Metrics, ) -> deadpool::managed::RecycleResult { if std::thread::panicking() || obj.is_broken() { - return Err(deadpool::managed::RecycleError::StaticMessage( - "Broken connection", + return Err(deadpool::managed::RecycleError::Message( + "Broken connection".into(), )); } obj.ping(&self.manager_config.recycling_method)