Use cached partition topology for metrics/logs

This commit is contained in:
Jonathan Klabunde Tomer 2025-04-24 08:29:58 -07:00 committed by GitHub
parent f191c68efc
commit 51569ce0a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -670,11 +670,10 @@ public class MessagesCache {
.thenRun(() -> sample.stop(clearQueueTimer));
}
// expensiveuse for rare error logging only
public String shardForSlot(int slot) {
try {
return redisCluster.withBinaryCluster(
connection -> ClusterPartitionParser.parse(connection.sync().clusterNodes()).getPartitionBySlot(slot).getUri().getHost());
connection -> connection.getPartitions().getPartitionBySlot(slot).getUri().getHost());
} catch (Throwable ignored) {
return "unknown";
}