Skip to content

Avoid unnecessary async handling in GraphQlHttpHandler #903

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

Closed
wants to merge 1 commit into from

Conversation

kilink
Copy link
Contributor

@kilink kilink commented Feb 7, 2024

In the webmvc GraphQlHttpHandler, return the server response directly if the WebGraphQlHandler returns an already completed Mono. This avoids some extra overhead incurred with async processing.

Some examples of queries that can be serviced without any async are introspection queries, and any query that avoids I/O (e.g., DataFetchers reading from in-memory stores or caches).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 7, 2024
@kilink kilink force-pushed the non-async-handling branch from c8fcbc7 to 24a7be2 Compare February 7, 2024 23:17
In the webmvc GraphQlHttpHandler, return the server response directly if the
WebGraphQlHandler returns an already completed Mono. This avoids some extra
overhead incurred with async processing.
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Feb 8, 2024

Thanks for the suggestion and pull request! I've gone with a slightly different implementation under #904, turning the Mono to CompletableFuture, which is what ServerResponse.async does internally, and checking if the future is done. Also created spring-projects/spring-framework#32223 to see if we can move it further into Spring MVC.

@rstoyanchev rstoyanchev closed this Feb 8, 2024
@rstoyanchev rstoyanchev added status: superseded Issue is superseded by another and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 8, 2024
@kilink kilink deleted the non-async-handling branch February 8, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded Issue is superseded by another
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants