Skip to content

Commit

Permalink
Changed the managment connection to only be preferred but to fallback…
Browse files Browse the repository at this point in the history
… to the user connection if needed
  • Loading branch information
barshaul committed Dec 21, 2023
1 parent 66fd410 commit fe1237c
Show file tree
Hide file tree
Showing 2 changed files with 271 additions and 76 deletions.
3 changes: 2 additions & 1 deletion redis/src/cluster_async/connections_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ where
ConnectionType::User => self.user_connection.clone(),
ConnectionType::PreferManagement => self
.management_connection
.clone()
.unwrap_or_else(|| self.user_connection.clone()),
}
}
Expand Down Expand Up @@ -631,7 +632,7 @@ mod tests {
fn get_random_management_connections() {
let container = create_container_with_strategy(ReadFromReplicaStrategy::RoundRobin);
let mut random_connections: Vec<_> = container
.random_connections(1000, ConnectionType::Management)
.random_connections(1000, ConnectionType::PreferManagement)
.map(|pair| pair.1)
.collect();
random_connections.sort();
Expand Down
Loading

0 comments on commit fe1237c

Please sign in to comment.