timeout
consttimeout: (config?) =>Policy
Defined in: src/policies/resilience/timeout.ts:35
Enforce a time budget for downstream execution.
Races next() against a timer. If the timer fires first, throws a
GatewayError (default 504). The timer is always cleaned up, even on
downstream errors.
Parameters
Section titled “Parameters”config?
Section titled “config?”Timeout duration and custom error message. Defaults to 30 seconds.
Returns
Section titled “Returns”A Policy at priority 85 (runs late, close to upstream).
Example
Section titled “Example”// 5-second timeout with custom messagetimeout({ timeoutMs: 5000, message: "Upstream did not respond in time" });