mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-10-20 14:12:10 -04:00
15 lines
380 B
TypeScript
15 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()
|
||
|
}
|
||
|
}
|