Skip to content

Commit b6fc0d0

Browse files
committed
Fix cluster scan deadlock
1 parent c9bbd5a commit b6fc0d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,10 @@ static <T extends ScanCursor, K, V> RedisFuture<T> clusterScan(StatefulRedisClus
769769
String currentNodeId = ClusterScanSupport.getCurrentNodeId(cursor, nodeIds);
770770
ScanCursor continuationCursor = ClusterScanSupport.getContinuationCursor(cursor);
771771

772-
RedisFuture<T> scanCursor = scanFunction.apply(connection.getConnection(currentNodeId).async(), continuationCursor);
772+
CompletionStage<T> stage = connection.getConnectionAsync(currentNodeId)
773+
.thenCompose(conn -> scanFunction.apply(conn.async(), continuationCursor).toCompletableFuture());
774+
775+
RedisFuture<T> scanCursor = new PipelinedRedisFuture<>(stage);
773776
return mapper.map(nodeIds, currentNodeId, scanCursor);
774777
}
775778

0 commit comments

Comments
 (0)