ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

19 lines
540 B

  1. import { HttpStatusCode } from '@peertube/peertube-models'
  2. import { logger } from '@server/helpers/logger.js'
  3. import express from 'express'
  4. export function setReqTimeout (timeoutMs: number) {
  5. return (req: express.Request, res: express.Response, next: express.NextFunction) => {
  6. req.setTimeout(timeoutMs, () => {
  7. logger.error('Express request timeout in ' + req.originalUrl)
  8. return res.fail({
  9. status: HttpStatusCode.REQUEST_TIMEOUT_408,
  10. message: 'Request has timed out.'
  11. })
  12. })
  13. next()
  14. }
  15. }