Skip to content

Update deadpool to 0.11 #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 47 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"]
Expand Down
5 changes: 2 additions & 3 deletions src/pooled_connection/deadpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ pub type Hook<C> = deadpool::managed::Hook<AsyncDieselConnectionManager<C>>;
/// Type alias for using [`deadpool::managed::HookError`] with [`diesel-async`]
pub type HookError = deadpool::managed::HookError<super::PoolError>;

#[async_trait::async_trait]
impl<C> Manager for AsyncDieselConnectionManager<C>
where
C: PoolableConnection + Send + 'static,
Expand All @@ -89,8 +88,8 @@ where
_: &deadpool::managed::Metrics,
) -> deadpool::managed::RecycleResult<Self::Error> {
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)
Expand Down