Skip to content
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 ASYNC dispatch if possible in DefaultAsyncServerResponse #32223

Closed
rstoyanchev opened this issue Feb 8, 2024 · 1 comment
Closed

Avoid ASYNC dispatch if possible in DefaultAsyncServerResponse #32223

rstoyanchev opened this issue Feb 8, 2024 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

Spring for GraphQL relies on the GraphQL Java AsyncExecutionStrategy as do most other solutions. However, the actual handling in some cases may return immediately without the need for blocking. For such cases, the ASYNC dispatch could be avoided to reduce overhead.

We are going to make a change spring-projects/spring-graphql#904 in Spring for GraphQL to call ServerResponse.async(future) conditionally, only if the future is not done, but this might be more generally useful.

This issue is to explore whether similar conditional logic could be done within the call to ServerResponse.async.

@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Feb 8, 2024
@rstoyanchev rstoyanchev added this to the 6.2.x milestone Feb 8, 2024
@poutsma poutsma self-assigned this Feb 8, 2024
@poutsma poutsma modified the milestones: 6.2.x, 6.2.0-M1 Feb 22, 2024
@poutsma
Copy link
Contributor

poutsma commented Feb 22, 2024

@rstoyanchev Done. Note that I did some additional checks on the future, compared to Spring GraphQL, to ensure that the future has not been canceled nor completed exceptionally, see here. You might want to include the same checks in Spring GraphQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants