diff --git a/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java b/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java index 856226ce7..77df18d5d 100755 --- a/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java +++ b/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java @@ -364,13 +364,12 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager { private void updateState(SentinelServersConfig cfg, RedisConnection connection, Iterator iterator, AtomicReference lastException) { List> futures = new ArrayList<>(); - CompletionStage masterFuture = checkMasterChange(cfg, connection); - futures.add(masterFuture.toCompletableFuture()); + CompletionStage f = checkMasterChange(cfg, connection); if (!config.isSlaveNotUsed()) { - CompletionStage slavesFuture = checkSlavesChange(cfg, connection); - futures.add(slavesFuture.toCompletableFuture()); + f = f.thenCompose(r -> checkSlavesChange(cfg, connection)); } + futures.add(f.toCompletableFuture()); CompletionStage sentinelsFuture = checkSentinelsChange(cfg, connection); futures.add(sentinelsFuture.toCompletableFuture());