Skip to content

Commit 27c8e7c

Browse files
committed
fix(redis): migrate to read_routing_strategy API
Replace the deprecated `ClusterClientBuilder::read_from_replicas()` call with `read_routing_strategy(RandomReplicaStrategy)`, introduced in redis 1.2.0. Bump the minimum `redis` dependency to 1.2 so downstream users resolve a version that ships the new API. Fixes `-D warnings` clippy failures on every open PR once cargo resolves redis 1.2.0 or newer.
1 parent 7e77f7f commit 27c8e7c

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

hitbox-redis/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Bump minimum `redis` dependency to 1.2 and migrate from deprecated `ClusterClientBuilder::read_from_replicas()` to `read_routing_strategy(RandomReplicaStrategy)`.
810

911
## [0.2.1] - 2026-02-09
1012

hitbox-redis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keywords = ["cache", "async", "cache-backend", "hitbox", "redis"]
1515
hitbox-backend = { path = "../hitbox-backend", version = "0.2" }
1616
hitbox = { path = "../hitbox", version = "0.2" }
1717
log = "0.4"
18-
redis = { version = "1.0", features = ["tokio-comp", "connection-manager"] }
18+
redis = { version = "1.2", features = ["tokio-comp", "connection-manager"] }
1919
thiserror = { workspace = true }
2020
async-trait = { workspace = true }
2121
serde = { workspace = true }

hitbox-redis/src/backend.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,9 @@ where
499499
config.nodes.iter().map(|s| s.as_str()),
500500
);
501501
if config.read_from_replicas {
502-
builder = builder.read_from_replicas();
502+
builder = builder.read_routing_strategy(
503+
redis::cluster_read_routing::RandomReplicaStrategy,
504+
);
503505
}
504506
if let Some(ref username) = self.username {
505507
builder = builder.username(username.clone());

0 commit comments

Comments
 (0)