Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
q3356564 committed Sep 13, 2024
1 parent 9a90e17 commit c6c9921
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 1 addition & 3 deletions core/src/services/redis/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -335,7 +334,6 @@ impl kv::Adapter for Adapter {
Capability {
read: true,
write: true,
delete: true,
..Default::default()
},
)
Expand Down
17 changes: 13 additions & 4 deletions core/src/services/redis/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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"))
Expand Down
4 changes: 2 additions & 2 deletions core/src/services/redis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
pub use config::RedisConfig;

0 comments on commit c6c9921

Please sign in to comment.