Serve
Features
Performance/Cache
Upstream Cancellation

Upstream Cancellation

💡

This page is currently under construction and expected to change. Please feel free to reach out to us directly in case you are having any troubles.

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, useUpstreamCancellation } from '@graphql-mesh/serve-cli'
 
export const serveConfig = defineConfig({
  plugins: pluginCtx => [useUpstreamCancellation()]
})