Skip to content

Commit ea9104d

Browse files
authored
Merge pull request #3943 from samuelAndalon/avoid-wrapping-fvi-completable-future
avoid wrapping materialized fieldValueObject in a CompletableFuture
2 parents bd56099 + 2e25aa8 commit ea9104d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

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

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

637637
FieldValueInfo fieldValueInfo = completeValue(executionContext, newParameters);
638-
639-
CompletableFuture<Object> executionResultFuture = fieldValueInfo.getFieldValueFuture();
640638
ctxCompleteField.onDispatched();
641-
executionResultFuture.whenComplete(ctxCompleteField::onCompleted);
639+
if (fieldValueInfo.isFutureValue()) {
640+
CompletableFuture<Object> executionResultFuture = fieldValueInfo.getFieldValueFuture();
641+
executionResultFuture.whenComplete(ctxCompleteField::onCompleted);
642+
} else {
643+
ctxCompleteField.onCompleted(fieldValueInfo.getFieldValueObject(), null);
644+
}
642645
return fieldValueInfo;
643646
}
644647

0 commit comments

Comments
 (0)