Skip to content

Commit 059a0ff

Browse files
authored
Merge pull request #3944 from samuelAndalon/22.x-avoid-wrapping-fvi-completable-future
avoid wrapping materialized fieldValueObject in a completable future
2 parents d6dbf61 + 9dbc4a9 commit 059a0ff

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,13 @@ private FieldValueInfo completeField(GraphQLFieldDefinition fieldDef, ExecutionC
651651
);
652652

653653
FieldValueInfo fieldValueInfo = completeValue(executionContext, newParameters);
654-
655-
CompletableFuture<Object> executionResultFuture = fieldValueInfo.getFieldValueFuture();
656654
ctxCompleteField.onDispatched();
657-
executionResultFuture.whenComplete(ctxCompleteField::onCompleted);
655+
if (fieldValueInfo.isFutureValue()) {
656+
CompletableFuture<Object> executionResultFuture = fieldValueInfo.getFieldValueFuture();
657+
executionResultFuture.whenComplete(ctxCompleteField::onCompleted);
658+
} else {
659+
ctxCompleteField.onCompleted(fieldValueInfo.getFieldValueObject(), null);
660+
}
658661
return fieldValueInfo;
659662
}
660663

0 commit comments

Comments
 (0)