codimd/lib/middleware/tooBusy.ts
Raccoon db55d00823
refactor: use config insted of * as config
config

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

15 lines
285 B
TypeScript

import toobusy from "toobusy-js";
import 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()
}
}