Skip to content

Commit

Permalink
Fix getting random connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
nihohit committed Sep 13, 2023
1 parent 075fe96 commit b8e9891
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions redis/src/cluster_async/connections_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ where
) -> impl Iterator<Item = ConnectionAndIdentifier<Connection>> + '_ {
self.connection_map
.iter()
.choose_multiple(&mut rand::thread_rng(), amount)
.into_iter()
.filter_map(|(identifier, connection)| {
connection
.as_ref()
.map(|connection| (identifier.clone(), connection.clone()))
connection.as_ref().map(|connection| (identifier, connection))
})
.choose_multiple(&mut rand::thread_rng(), amount)
.into_iter()
.map(|(identifier, connection)| (identifier.clone(), connection.clone()))
}

pub(crate) fn replace_or_add_connection_for_address(
Expand Down

0 comments on commit b8e9891

Please sign in to comment.