codimd/lib/middleware/tooBusy.ts
Raccoon 231672d455
ts: lib/middleware/tooBusy.js
Signed-off-by: Raccoon <raccoon@hackmd.io>
2021-06-16 18:35:21 +08:00

15 lines
289 B
TypeScript

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