Skip to content

Commit

Permalink
perf: use cffuCompleteOnTimeout instead of cffuOrTimeout in `most…
Browse files Browse the repository at this point in the history
…Of*` methods for single input cf ⚡️

`cffuCompleteOnTimeout` won't create `TimeoutException`
  • Loading branch information
oldratlee committed Jun 15, 2024
1 parent bf97d1c commit 0bc87bd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public static <T> CompletableFuture<List<T>> mostResultsOfSuccess(
// 1. avoid writing it by `cffuOrTimeout` and is able to read its result(`getSuccessNow`)
// 2. ensure that the returned cf is not minimal-stage CF instance(UnsupportedOperationException)
final CompletableFuture<T> f = toNonMinCfCopy(requireNonNull(cfs[0], "cf1 is null"));
return cffuOrTimeout(f, executorWhenTimeout, timeout, unit)
return cffuCompleteOnTimeout(f, valueIfNotSuccess, executorWhenTimeout, timeout, unit)
.handle((unused, ex) -> arrayList(getSuccessNow(f, valueIfNotSuccess)));
}

Expand Down

0 comments on commit 0bc87bd

Please sign in to comment.