Skip to content

Commit

Permalink
uncommented
Browse files Browse the repository at this point in the history
  • Loading branch information
soloseng committed Sep 1, 2023
1 parent 4e32ccd commit eda3f24
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/phone-number-privacy/signer/src/common/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ export function meteringHandler<R extends OdisRequest>(
}

export function timeoutHandler<R extends OdisRequest>(
_timeoutMs: number,
timeoutMs: number,
handler: PromiseHandler<R>
): PromiseHandler<R> {
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)
}
Expand Down

0 comments on commit eda3f24

Please sign in to comment.