Fixed - Sentinels discovery is applied at Redisson startup if sentinelsDiscovery = true

pull/5875/head
Nikita Koksharov 9 months ago
parent 0b60e270c3
commit 1b6cc8cee0

@ -144,8 +144,9 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager {
} }
} }
List<CompletableFuture<Void>> connectionFutures = new LinkedList<>();
if (cfg.isSentinelsDiscovery()) {
List<Map<String, String>> sentinelSentinels = connection.sync(StringCodec.INSTANCE, RedisCommands.SENTINEL_SENTINELS, cfg.getMasterName()); List<Map<String, String>> sentinelSentinels = connection.sync(StringCodec.INSTANCE, RedisCommands.SENTINEL_SENTINELS, cfg.getMasterName());
List<CompletableFuture<Void>> connectionFutures = new ArrayList<>(sentinelSentinels.size());
for (Map<String, String> map : sentinelSentinels) { for (Map<String, String> map : sentinelSentinels) {
if (map.isEmpty()) { if (map.isEmpty()) {
continue; continue;
@ -158,6 +159,7 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager {
CompletionStage<Void> future = registerSentinel(sentinelAddr); CompletionStage<Void> future = registerSentinel(sentinelAddr);
connectionFutures.add(future.toCompletableFuture()); connectionFutures.add(future.toCompletableFuture());
} }
}
CompletionStage<Void> f = registerSentinel(connection.getRedisClient().getAddr()); CompletionStage<Void> f = registerSentinel(connection.getRedisClient().getAddr());
connectionFutures.add(f.toCompletableFuture()); connectionFutures.add(f.toCompletableFuture());

Loading…
Cancel
Save