diff --git a/Cargo.toml b/Cargo.toml index f9ab756..50e82bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ readme = "README.md" lazy_static = "1" rand = "0.8" radix_fmt = "1" -bb8 = "0.7" +bb8 = "0.8" thiserror = "1" redis = { version = "0.23", features = ["tokio-comp", "async-std-comp"] } async-trait = "0.1" diff --git a/src/pooled_facade.rs b/src/pooled_facade.rs index adcf406..298162c 100644 --- a/src/pooled_facade.rs +++ b/src/pooled_facade.rs @@ -3,12 +3,10 @@ use crate::r#trait::RsmqConnection; use crate::types::RedisBytes; use crate::types::{RsmqMessage, RsmqOptions, RsmqQueueAttributes}; use crate::RsmqResult; -use core::convert::TryFrom; -use std::marker::PhantomData; -use std::ops::DerefMut; - use async_trait::async_trait; +use core::convert::TryFrom; use redis::RedisError; +use std::marker::PhantomData; #[derive(Clone, Debug)] pub struct RedisConnectionManager { @@ -34,11 +32,8 @@ impl bb8::ManageConnection for RedisConnectionManager { self.client.get_async_connection().await } - async fn is_valid( - &self, - conn: &mut bb8::PooledConnection<'_, Self>, - ) -> Result<(), Self::Error> { - redis::cmd("PING").query_async(conn.deref_mut()).await + async fn is_valid(&self, conn: &mut redis::aio::Connection) -> Result<(), Self::Error> { + redis::cmd("PING").query_async(conn).await } fn has_broken(&self, _: &mut Self::Connection) -> bool { @@ -85,7 +80,7 @@ impl PooledRsmq { password, options.host, options.port, options.db ); - let manager = RedisConnectionManager::new(url).unwrap(); + let manager = RedisConnectionManager::new(url)?; let builder = bb8::Pool::builder(); let mut builder = if let Some(value) = pool_options.max_size { @@ -96,7 +91,7 @@ impl PooledRsmq { builder = builder.min_idle(pool_options.min_idle); - let pool = builder.build(manager).await.unwrap(); + let pool = builder.build(manager).await?; Ok(PooledRsmq { pool,