Skip to content

Commit 2bfd809

Browse files
committed
comment
1 parent 15a61e1 commit 2bfd809

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/graphql/execution/ExecutionStrategy.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ private Object fetchField(GraphQLFieldDefinition fieldDef, ExecutionContext exec
486486
if (fetchedObject instanceof CompletableFuture) {
487487
@SuppressWarnings("unchecked")
488488
CompletableFuture<Object> originalFetchValue = (CompletableFuture<Object>) fetchedObject;
489+
// the completion order of dependent CFs is in stack order for
490+
// directly dependent CFs, but in reverse stack order for indirect dependent ones
491+
// By creating one dependent CF on originalFetchValue, we make sure the order it is always
492+
// in reverse stack order
489493
CompletableFuture<Object> fetchedValue = originalFetchValue.thenApply(Function.identity());
490494
executionContext.incrementRunning(fetchedValue);
491495
CompletableFuture<Object> rawResultCF = fetchedValue

0 commit comments

Comments
 (0)