mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 12:08:02 -05:00
e5961336b7
Signed-off-by: David Mehren <dmehren1@gmail.com>
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()
|
|
}
|
|
}
|