diff --git a/redisson/src/main/java/org/redisson/command/CommandBatchService.java b/redisson/src/main/java/org/redisson/command/CommandBatchService.java index fb28ebbf4..49e9737e5 100644 --- a/redisson/src/main/java/org/redisson/command/CommandBatchService.java +++ b/redisson/src/main/java/org/redisson/command/CommandBatchService.java @@ -478,7 +478,12 @@ public class CommandBatchService extends CommandAsyncService { AtomicInteger attempt = new AtomicInteger(); CompletableFuture> resolvedEntriesFuture = new CompletableFuture<>(); resolveCommands(attempt, resolvedEntriesFuture); - resolvedEntriesFuture.thenAccept(map -> { + resolvedEntriesFuture.whenComplete((map, ee) -> { + if (ee != null) { + resultPromise.completeExceptionally(ee); + return; + } + List> futures = new ArrayList<>(map.size()); for (Map.Entry entry : aggregatedCommands.entrySet()) { boolean isReadOnly = options.getExecutionMode() == ExecutionMode.REDIS_READ_ATOMIC;