codimd/lib/middleware/tooBusy.ts
Raccoon 6f93e43978
move app.js to lib/
update

Signed-off-by: Raccoon <raccoon@hackmd.io>
2021-06-16 18:35:31 +08:00

15 lines
295 B
TypeScript

import * as toobusy from "toobusy-js";
import * as config from "../config";
import * as response from "../response";
toobusy.maxLag(config.responseMaxLag)
export default function (req, res, next) {
if (toobusy()) {
response.errorServiceUnavailable(req, res)
} else {
next()
}
}