Skip to content

Commit 2e25aa8

Browse files
author
Samuel Vazquez
committed
avoid wrapping materialized fieldValueObject in a completable future
1 parent bd56099 commit 2e25aa8

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)