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 https://github.com/spring-projects/spring-graphql/issues/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
.
Comment From: poutsma
@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.