mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-18 18:37:35 -05:00
7b9f9a487b
Signed-off-by: David Mehren <git@herrmehren.de>
14 lines
372 B
TypeScript
14 lines
372 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 function tooBusy (req: Request, res: Response, next: NextFunction): void {
|
|
if (toobusy()) {
|
|
errors.errorServiceUnavailable(res)
|
|
} else {
|
|
next()
|
|
}
|
|
}
|