diff --git a/packages/phone-number-privacy/signer/src/common/handler.ts b/packages/phone-number-privacy/signer/src/common/handler.ts index fb8ff5fdee4..59ec0501a62 100644 --- a/packages/phone-number-privacy/signer/src/common/handler.ts +++ b/packages/phone-number-privacy/signer/src/common/handler.ts @@ -99,21 +99,21 @@ export function meteringHandler( } export function timeoutHandler( - _timeoutMs: number, + timeoutMs: number, handler: PromiseHandler ): PromiseHandler { return async (req, res) => { - // const timeoutSignal = (AbortSignal as any).timeout(timeoutMs) - // timeoutSignal.addEventListener( - // 'abort', - // () => { - // if (!res.headersSent) { - // Counters.timeouts.inc() - // sendFailure(ErrorMessage.TIMEOUT_FROM_SIGNER, 500, res, req.url) - // } - // }, - // { once: true } - // ) + const timeoutSignal = (AbortSignal as any).timeout(timeoutMs) + timeoutSignal.addEventListener( + 'abort', + () => { + if (!res.headersSent) { + Counters.timeouts.inc() + sendFailure(ErrorMessage.TIMEOUT_FROM_SIGNER, 500, res, req.url) + } + }, + { once: true } + ) await handler(req, res) }