refactoring

pull/5732/head
Nikita Koksharov 10 months ago
parent 8d0ca5f99b
commit 26ff36e6f6

@ -943,7 +943,15 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
private Collection<ClusterPartition> getLastPartitions() {
return lastUri2Partition.values();
}
public int getSlot(MasterSlaveEntry entry) {
return lastPartitions.entrySet().stream()
.filter(e -> e.getValue().getMasterAddress().equals(entry.getClient().getConfig().getAddress()))
.findAny()
.map(m -> m.getKey())
.orElse(-1);
}
@Override
public RedisURI getLastClusterNode() {
return lastClusterNode;

Loading…
Cancel
Save