diff --git a/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java b/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java index 0fd96926f9..20b07f67c4 100644 --- a/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java +++ b/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java @@ -56,7 +56,7 @@ class NodeTopologyView { this.redisURI = redisURI; this.partitions = ClusterPartitionParser.parse(clusterNodes); - this.connectedClients = getClients(clientList); + this.connectedClients = clientList != null ? getClients(clientList) : 0; this.clusterNodes = clusterNodes; this.clientList = clientList; this.latency = latency; @@ -69,11 +69,19 @@ static NodeTopologyView from(RedisURI redisURI, Requests clusterNodesRequests, R TimedAsyncCommand clients = clientListRequests.getRequest(redisURI); if (resultAvailable(nodes) && resultAvailable(clients)) { - return new NodeTopologyView(redisURI, nodes.get(), clients.get(), nodes.duration()); + return new NodeTopologyView(redisURI, nodes.get(), optionallyGet(clients), nodes.duration()); } return new NodeTopologyView(redisURI); } + private static T optionallyGet(TimedAsyncCommand command) throws ExecutionException, InterruptedException { + + if (command.isCompletedExceptionally()) { + return null; + } + return command.get(); + } + static boolean resultAvailable(RedisFuture redisFuture) { if (redisFuture != null && redisFuture.isDone() && !redisFuture.isCancelled()) {