graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

Allow execution to be cancelled

Open glasser opened this issue 3 years ago • 0 comments

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.

glasser avatar Oct 20 '22 19:10 glasser