Upstream Cancellation
This feature enables you to cancel the upstream HTTP requests when the client cancels the downstream GraphQL request. This can be useful when you want to save resources on your server and the services.
There is also Execution Cancellation that
stops the execution, but it doesn’t stop ongoing HTTP requests. This seperately allows you to stop
the HTTP requests by hooking into
fetch
.
Enable Upstream Cancellation
mesh.config.ts
import { defineConfig as defineServeConfig, useUpstreamCancellation } from '@graphql-mesh/serve-cli'
export const serveConfig = defineServeConfig({
plugins: pluginCtx => [useUpstreamCancellation()]
})