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

Make async execution the default #99

Closed
kaqqao opened this issue Mar 21, 2021 · 0 comments
Closed

Make async execution the default #99

kaqqao opened this issue Mar 21, 2021 · 0 comments

Comments

@kaqqao
Copy link
Member

kaqqao commented Mar 21, 2021

Since Spring MVC supports async responses, and graphql-java itself works asynchronously, we can safely go fully async and bring the default MVC executor in line with the WebFlux one.
The only downside is that it breaks existing tests using MockMvc. The options are to use asyncDispatch or use blocking execution in tests.

To restore the old blocking behavior, it is enough to add graphql.spqr.http.mvc.executor=blocking to application.properties. This is what we do in our own tests.

The affect of this is the same is as if new DefaultGraphQLExecutor(...).blocking() was registered as a bean, e.g.:

@Bean
public GraphQLMvcExecutor blockingExecutor(
                        MvcContextFactory contextFactory,
                        Optional<DataLoaderRegistryFactory> loaderFactory) {
    new DefaultGraphQLExecutor(contextFactory, dataLoaderRegistryFactory.orElse(null)).blocking();
}
@kaqqao kaqqao closed this as completed in 03420ff Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant