From d565bbfef2002eafc73cfa3d139253b32d958679 Mon Sep 17 00:00:00 2001 From: Shachar Langbeheim Date: Mon, 13 Jan 2025 11:32:15 +0200 Subject: [PATCH] User redis 0.28. The latest releases include safety & performance improvements. This change removes the usage of `redis::aio::Connection`, because it was deprecated due to being unsafe to use after errors. --- mobc-redis/Cargo.toml | 2 +- mobc-redis/src/lib.rs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mobc-redis/Cargo.toml b/mobc-redis/Cargo.toml index 07d05a1..6313a72 100644 --- a/mobc-redis/Cargo.toml +++ b/mobc-redis/Cargo.toml @@ -12,7 +12,7 @@ keywords = ["redis", "pool", "async", "await"] [dependencies] mobc = { version = "0.8", path = ".." } -redis = { version = "0.24.0" } +redis = { version = "0.28" } [features] default = ["mobc/tokio", "redis/tokio-comp"] diff --git a/mobc-redis/src/lib.rs b/mobc-redis/src/lib.rs index 332ca0a..17cf65c 100644 --- a/mobc-redis/src/lib.rs +++ b/mobc-redis/src/lib.rs @@ -1,9 +1,9 @@ -pub use redis; pub use mobc; +pub use redis; use mobc::async_trait; use mobc::Manager; -use redis::aio::Connection; +use redis::aio::MultiplexedConnection as Connection; use redis::{Client, ErrorKind}; pub struct RedisConnectionManager { @@ -22,7 +22,7 @@ impl Manager for RedisConnectionManager { type Error = redis::RedisError; async fn connect(&self) -> Result { - let c = self.client.get_async_connection().await?; + let c = self.client.get_multiplexed_async_connection().await?; Ok(c) } @@ -34,5 +34,3 @@ impl Manager for RedisConnectionManager { Ok(conn) } } - -