diff --git a/packages/documentation/content/docs/api-reference/gateway-config.mdx b/packages/documentation/content/docs/api-reference/gateway-config.mdx index 4c985e86..930e5667 100644 --- a/packages/documentation/content/docs/api-reference/gateway-config.mdx +++ b/packages/documentation/content/docs/api-reference/gateway-config.mdx @@ -624,17 +624,35 @@ Number of worker processes to spawn. Useful for utilizing multiple CPU cores. ### `requestTimeout` -Request timeout in milliseconds (Node) or seconds (Bun). Set to `0` to disable. +Sets the maximum time in milliseconds allowed to receive the entire request from the client (headers + body). Once the body is fully received, this timer is cancelled and the handler can run indefinitely. Set to `0` to disable. + +For a hard end-to-end deadline, use [`requestDeadline`](#requestdeadline) instead. ```ts title="gateway.config.ts" import { defineConfig } from "@graphql-hive/gateway"; export const gatewayConfig = defineConfig({ - // Node: requestTimeout: 30_000, // 30 seconds +}); +``` + +### `requestDeadline` + +Sets a hard end-to-end time limit in milliseconds for the entire request lifecycle, from connection to response completion. Unlike [`requestTimeout`](#requesttimeout), this timer is not cancelled when the request body is received - it runs until the response is finished. When the deadline is exceeded, the server responds with a 503 and closes the connection. + + + +In Bun, streamed responses (e.g. defer/stream) are not covered by this +deadline. The timer only applies until the Response object is created; once +streaming begins, the body can continue past the deadline. - // Bun uses seconds instead of milliseconds: - requestTimeout: 30, // 30 seconds + + +```ts title="gateway.config.ts" +import { defineConfig } from "@graphql-hive/gateway"; + +export const gatewayConfig = defineConfig({ + requestDeadline: 30_000, // 30 seconds }); ```