summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBoHong Li2017-04-12 06:05:43 +0800
committerRaccoon Li2017-05-08 19:29:06 +0800
commit7ef17fd4e61503178875dd34f998203264ffb691 (patch)
tree0e8d40efdea92676bf579cc127fae1eb2c5e1a4e /lib
parent768943002c7f9bdac7f674338f18e567c16bda52 (diff)
refactor(app.js): Extract tooBusy
Diffstat (limited to 'lib')
-rw-r--r--lib/web/middleware/tooBusy.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/web/middleware/tooBusy.js b/lib/web/middleware/tooBusy.js
new file mode 100644
index 00000000..f1b72330
--- /dev/null
+++ b/lib/web/middleware/tooBusy.js
@@ -0,0 +1,13 @@
+'use strict'
+
+const toobusy = require('toobusy-js')
+
+const response = require('../../response')
+
+module.exports = function (req, res, next) {
+ if (toobusy()) {
+ response.errorServiceUnavailable(res)
+ } else {
+ next()
+ }
+}