mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00

Signed-off-by: Yannick Bungers <git@innay.de> Signed-off-by: David Mehren <dmehren1@gmail.com>
14 lines
380 B
TypeScript
14 lines
380 B
TypeScript
import toobusy from 'toobusy-js'
|
|
import { errors } from '../../errors'
|
|
import { config } from '../../config'
|
|
import { NextFunction, Request, Response } from 'express'
|
|
|
|
toobusy.maxLag(config.tooBusyLag)
|
|
|
|
export default function tooBusy (req: Request, res: Response, next: NextFunction): void {
|
|
if (toobusy()) {
|
|
errors.errorServiceUnavailable(res)
|
|
} else {
|
|
next()
|
|
}
|
|
}
|