2017-04-11 22:05:43 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const toobusy = require('toobusy-js')
|
|
|
|
|
|
|
|
const response = require('../../response')
|
2018-11-26 23:26:25 +00:00
|
|
|
const config = require('../../config')
|
|
|
|
|
|
|
|
toobusy.maxLag(config.tooBusyLag)
|
2017-04-11 22:05:43 +00:00
|
|
|
|
|
|
|
module.exports = function (req, res, next) {
|
|
|
|
if (toobusy()) {
|
|
|
|
response.errorServiceUnavailable(res)
|
|
|
|
} else {
|
|
|
|
next()
|
|
|
|
}
|
|
|
|
}
|