Skip to content

Commit

Permalink
Fixed - wrong error message if Sentinel server has misconfiguration #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Koksharov committed Sep 2, 2019
1 parent e64392b commit 23fd2a6
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -142,11 +142,16 @@ public SentinelConnectionManager(SentinelServersConfig cfg, Config config, UUID

RedisClient client = createClient(NodeType.SENTINEL, addr, this.config.getConnectTimeout(), this.config.getTimeout(), null);
try {
RedisConnection connection = client.connect();
if (!connection.isActive()) {
RedisConnection connection = null;
try {
connection = client.connect();
if (!connection.isActive()) {
continue;
}
} catch (RedisConnectionException e) {
continue;
}

List<String> master = connection.sync(RedisCommands.SENTINEL_GET_MASTER_ADDR_BY_NAME, cfg.getMasterName());
if (master.isEmpty()) {
throw new RedisConnectionException("Master node is undefined! SENTINEL GET-MASTER-ADDR-BY-NAME command returns empty result!");
Expand Down Expand Up @@ -204,8 +209,6 @@ public SentinelConnectionManager(SentinelServersConfig cfg, Config config, UUID
}

break;
} catch (RedisConnectionException e) {
// skip
} finally {
client.shutdownAsync();
}
Expand Down

0 comments on commit 23fd2a6

Please sign in to comment.