From c6c9921664df7cba483d7e5cfdd1c171fc91c2a0 Mon Sep 17 00:00:00 2001 From: lizhenglei <673421862@qq.com> Date: Fri, 13 Sep 2024 12:13:16 +0800 Subject: [PATCH] fix --- core/src/services/redis/backend.rs | 4 +--- core/src/services/redis/core.rs | 17 +++++++++++++---- core/src/services/redis/mod.rs | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/core/src/services/redis/backend.rs b/core/src/services/redis/backend.rs index b3fd69c5dab..df08c46864a 100644 --- a/core/src/services/redis/backend.rs +++ b/core/src/services/redis/backend.rs @@ -28,7 +28,6 @@ use std::fmt::Debug; use std::fmt::Formatter; use std::path::PathBuf; use std::time::Duration; - use tokio::sync::OnceCell; use crate::raw::adapters::kv; @@ -301,7 +300,7 @@ impl Adapter { .map_err(|err| { Error::new(ErrorKind::ConfigInvalid, "connect to redis failed") .set_source(err) - }); + }) }) .await?; pool.get().await.map_err(|err| match err { @@ -335,7 +334,6 @@ impl kv::Adapter for Adapter { Capability { read: true, write: true, - delete: true, ..Default::default() }, ) diff --git a/core/src/services/redis/core.rs b/core/src/services/redis/core.rs index 2121237507b..ce77dc4f83e 100644 --- a/core/src/services/redis/core.rs +++ b/core/src/services/redis/core.rs @@ -15,11 +15,20 @@ // specific language governing permissions and limitations // under the License. -use crate::{Buffer, Error, ErrorKind}; -use redis::aio::{ConnectionLike, ConnectionManager}; +use crate::Buffer; +use crate::Error; +use crate::ErrorKind; + +use redis::aio::ConnectionLike; +use redis::aio::ConnectionManager; + use redis::cluster::ClusterClient; use redis::cluster_async::ClusterConnection; -use redis::{from_redis_value, AsyncCommands, Client, RedisError}; +use redis::from_redis_value; +use redis::AsyncCommands; +use redis::Client; +use redis::RedisError; + use std::time::Duration; #[derive(Clone)] @@ -131,7 +140,7 @@ impl bb8::ManageConnection for RedisConnectionManager { }; let pong: String = from_redis_value(&pong_value).map_err(format_redis_error)?; - if pong == String::from("PONG") { + if pong == "PONG" { Ok(()) } else { Err(Error::new(ErrorKind::Unexpected, "PING ERROR")) diff --git a/core/src/services/redis/mod.rs b/core/src/services/redis/mod.rs index 63fac0c8e6d..7ec39a5e832 100644 --- a/core/src/services/redis/mod.rs +++ b/core/src/services/redis/mod.rs @@ -19,7 +19,7 @@ mod backend; #[cfg(feature = "services-redis")] pub use backend::RedisBuilder as Redis; +mod config; #[cfg(feature = "services-redis")] mod core; -mod config; -pub use config::RedisConfig; \ No newline at end of file +pub use config::RedisConfig;