mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-16 08:04:45 -04:00
refactor(app.js): Extract tooBusy
This commit is contained in:
parent
768943002c
commit
7ef17fd4e6
2 changed files with 15 additions and 8 deletions
13
lib/web/middleware/tooBusy.js
Normal file
13
lib/web/middleware/tooBusy.js
Normal file
|
@ -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()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue