/** * Timeout Manager * * Handles request timeout logic with Promise.race pattern for the runtime handler. * * @module server/runtime-handler/timeout-manager */ interface RequestTimeoutOptions { /** Preserve cancellation from the inbound request while adding the timeout. */ signal?: AbortSignal; /** Override the configured timeout. Intended for focused tests. */ timeoutMs?: number; } /** * Execute a handler with a timeout, returning a timeout response if exceeded. * * An AbortController is created per request; its signal is passed to the handler * so network calls and renders can observe cancellation. When the timeout fires * the controller is aborted before returning the 504 response. * * The returned `settled` promise resolves once the underlying handler finishes * (whether it completed normally, threw, or was aborted). Callers that track * in-flight work for graceful drain should wait on `settled` before decrementing * their counters. Otherwise a timed-out request may be counted as done while * work is still running. * * @param executeHandler - The async function to execute; receives an AbortSignal * @param pathname - The request pathname (for logging) * @param method - The HTTP method (for logging) * @returns The handler response or a timeout response, plus a drain sentinel */ export declare function withRequestTimeout(executeHandler: (signal: AbortSignal) => Promise, pathname: string, method: string, options?: RequestTimeoutOptions): Promise<{ response: Response; error?: Error; settled: Promise; }>; export {}; //# sourceMappingURL=timeout-manager.d.ts.map