graphql-js
graphql-js copied to clipboard
Allow execution to be cancelled
Once execution begins, there's no way to stop it from running until completion.
However, servers may want to be able to stop execution. For example:
- Servers may have a response timeout; there's no use continuing to execute fields after the server has returned a "request timed out" error.
- Servers may want to avoid OOM attacks via nested lists by dynamically enforcing a maximum number of resolved fields and cancelling once too many fields have been resolved.
It would be helpful if execute (and experimentalExecuteIncrementally, etc) had a mechanism for cancelling execution. This could be based on web-style AbortSignal/AbortController or a different API style.