-
Notifications
You must be signed in to change notification settings - Fork 1.2k
avoid wrapping materialized fieldValueObject in a CompletableFuture #3943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid wrapping materialized fieldValueObject in a CompletableFuture #3943
Conversation
| CompletableFuture<Object> executionResultFuture = fieldValueInfo.getFieldValueFuture(); | ||
| ctxCompleteField.onDispatched(); | ||
| executionResultFuture.whenComplete(ctxCompleteField::onCompleted); | ||
| if (fieldValueInfo.isFutureValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could've done this as well but it has the unchecked cast already handled internally by FieldValueInfo
Object executionResult = fieldValueInfo.getFieldValueObject();
ctxCompleteField.onDispatched();
if (executionResult instanceof CompletableFuture) {
@SuppressWarnings("unchecked")
CompletableFuture<Object> executionResultFuture = (CompletableFuture<Object>) executionResult;
executionResultFuture.whenComplete(ctxCompleteField::onCompleted);
} else {
ctxCompleteField.onCompleted(executionResult, null);
}
bbakerman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch - I am embarrassed I missed this in the great "materialised migration" effort
|
all good! thank you, now I am curious the memory and CPU improvement this change will bring |
|
@bbakerman I wonder if this can be cherry picked to version 22.x ? I can prepare the PR. |
While updating graphql-kotlin to graphql-java 23 found that
completeFieldis still wrappingFieldValueInfo.fieldValueObjectin aCompletableFuturefor objects already materialized / in memorythis might be considered a follow up of the
Completable Future wrappingchange set that came in graphql-java 22https://github.com/graphql-java/graphql-java/releases/tag/v22.0
I don't think this is a breaking change.