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
Send status 200 as soon as query parse is valid #3226
Comments
Hmm interesting use case, but if we do that, this won't be valid anymore for status codes; |
So it would be after |
Due to the current design of Yoga, it is not possible with the Fetch based API we currently provide but depending on what you use as a server underneath you can manipulate the original response object available in the context. For example, it is "context.res" in vanilla Node.js |
As per GraphQL over HTTP spec, the response is to be sent when the operation execution is done. Yoga is following the spec and will stay compliant. There is a few things you can do:
If you still decide to go with 4. - you must make sure to handle the following:
|
A possible solution could be using a different transport, e.g. GraphQL over SSE, as it also sends pings. But I also noticed that in Yoga for GraphQL over SSE, the status code is blocked by the initial execution result. |
Is your feature request related to a problem? Please describe.
Our nginx proxy automatically sends 502 if the server takes too long to respond. This is a good feature IMHO.
However, if a mutation takes a long time to process, that means the caller will get 502 instead of the result.
Describe the solution you'd like
As soon as the query is parsed and deemed valid, before running the resolvers, yoga should already respond with 200.
Describe alternatives you've considered
Complicated async setups with subscriptions.
The text was updated successfully, but these errors were encountered: