From b237c65f43d324635f28a67ae674af481a138125 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Tue, 17 May 2022 09:55:06 +0300 Subject: [PATCH] refactoring --- .../main/java/org/redisson/command/CommandAsyncService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redisson/src/main/java/org/redisson/command/CommandAsyncService.java b/redisson/src/main/java/org/redisson/command/CommandAsyncService.java index c41d4a96b..76a028282 100644 --- a/redisson/src/main/java/org/redisson/command/CommandAsyncService.java +++ b/redisson/src/main/java/org/redisson/command/CommandAsyncService.java @@ -594,13 +594,14 @@ public class CommandAsyncService implements CommandAsyncExecutor { } CompletableFuture future = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); - CompletableFuture result = future.whenComplete((res, e) -> { + CompletableFuture result = future.thenApply(r -> { futures.forEach(f -> { if (!f.isCompletedExceptionally() && f.getNow(null) != null) { callback.onSlotResult((T) f.getNow(null)); } }); - }).thenApply(r -> callback.onFinish()); + return callback.onFinish(); + }); return new CompletableFutureWrapper<>(result); }