Skip to content

Commit bc36657

Browse files
committed
CompletableFuture#thenCompose isn't stack-safe, so c-switch zips for now
1 parent a14042c commit bc36657

File tree

1 file changed

+3
-3
lines changed
  • src/main/java/com/jnape/palatable/lambda/io

1 file changed

+3
-3
lines changed

src/main/java/com/jnape/palatable/lambda/io/IO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ public CompletableFuture<A> unsafePerformAsyncIO(Executor executor) {
312312
@SuppressWarnings("unchecked")
313313
CompletableFuture<A> future = (CompletableFuture<A>) deforest(new LinkedList<>())
314314
.into((source, compositions) -> foldLeft(
315-
(io, composition) -> composition
315+
(ioFuture, composition) -> composition
316316
.match(zip -> zip.unsafePerformAsyncIO(executor)
317-
.thenCompose(f -> io.thenApply(f.toFunction())),
318-
flatMap -> io.thenComposeAsync(obj -> flatMap.apply(obj)
317+
.thenComposeAsync(f -> ioFuture.thenApply(f.toFunction()), executor),
318+
flatMap -> ioFuture.thenComposeAsync(obj -> flatMap.apply(obj)
319319
.unsafePerformAsyncIO(executor), executor)),
320320
source.unsafePerformAsyncIO(executor),
321321
compositions));

0 commit comments

Comments
 (0)