diff --git a/Cargo.toml b/Cargo.toml index 3992dc7..26546c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,8 +52,8 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread", "time", "sync" uuid = { version = "1", features = ["v4"] } etcd-client = { version = "0.14", optional = true } -redis = { version = "0.27.6", optional = true, features = ["tokio-comp"] } +redis = { version = "0.28.1", optional = true, features = ["tokio-comp"] } [dev-dependencies] pretty_env_logger = "0.5" -redis-test = { version = "0.6.0", features = ["aio"] } +redis-test = { version = "0.8.0", features = ["aio"] } diff --git a/src/driver/redis.rs b/src/driver/redis.rs index 4f243c4..b964341 100644 --- a/src/driver/redis.rs +++ b/src/driver/redis.rs @@ -139,11 +139,11 @@ where /// * `node_id` - The id of the node /// * `timeout` - The timeout of the node /// * `con` - The redis connection -async fn register_node( +async fn register_node( node_id: &str, timeout: u64, con: &mut C, -) -> Result<(), Box> { +) -> Result<(), redis::RedisError> { con.set_ex(node_id, node_id, timeout).await?; Ok(()) } @@ -161,7 +161,7 @@ async fn register_node( /// # Returns /// /// * `Result<(), Box` - The result of the function -async fn heartbeat( +async fn heartbeat( node_id: &str, timeout: u64, con: C, diff --git a/src/driver/redis_zset.rs b/src/driver/redis_zset.rs index c6d0fc6..e161147 100644 --- a/src/driver/redis_zset.rs +++ b/src/driver/redis_zset.rs @@ -146,12 +146,12 @@ where /// * `node_id` - The id of the node /// * `con` - The redis connection /// * `time` - The time to register the node -async fn register_node( +async fn register_node( service_name: &str, node_id: &str, con: &mut C, time: i64, -) -> Result<(), Box> { +) -> Result<(), redis::RedisError> { con.zadd(utils::get_zset_key(service_name), node_id, time).await?; Ok(())