Fixed - Redisson connection process may hang in at start in some cases. #5430

pull/5457/head
Nikita Koksharov 1 year ago
parent 0182913956
commit b119e7bb2c

@ -213,11 +213,23 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
masterSlaveEntry = new MasterSlaveEntry(this, serviceManager.getConnectionWatcher(), config);
}
CompletableFuture<RedisClient> masterFuture = masterSlaveEntry.setupMasterEntry(new RedisURI(config.getMasterAddress()));
masterFuture.join();
try {
masterFuture.get(config.getConnectTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException | TimeoutException e) {
throw new RedisConnectionException(e);
}
if (!config.isSlaveNotUsed()) {
CompletableFuture<Void> fs = masterSlaveEntry.initSlaveBalancer(getDisconnectedNodes());
fs.join();
try {
fs.get(config.getConnectTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException | TimeoutException e) {
throw new RedisConnectionException(e);
}
}
startDNSMonitoring(masterFuture.getNow(null));

Loading…
Cancel
Save