codimd/lib/middleware/tooBusy.js
BoHong Li b4ec353fcd
refactor: remove web folder
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2020-01-06 14:19:02 +08:00

17 lines
303 B
JavaScript

'use strict'
const toobusy = require('toobusy-js')
const config = require('../config')
const response = require('../response')
toobusy.maxLag(config.responseMaxLag)
module.exports = function (req, res, next) {
if (toobusy()) {
response.errorServiceUnavailable(res)
} else {
next()
}
}