From 6c62efae2ad2dac6f4c58bd84726cfb36ea9a84b Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Tue, 27 Nov 2018 00:26:25 +0100 Subject: Add config for toobusy middleware With very low CPU frequency or bad IO situation, as well as not-loaded JS CodiMD happens to present unneeded "I'm busy"-messages to users. This patch allows to configure the lag. The default is taken from the libray but set in our own default configs. Signed-off-by: Sheogorath --- lib/web/middleware/tooBusy.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/web/middleware/tooBusy.js') diff --git a/lib/web/middleware/tooBusy.js b/lib/web/middleware/tooBusy.js index f1b72330..128a5679 100644 --- a/lib/web/middleware/tooBusy.js +++ b/lib/web/middleware/tooBusy.js @@ -2,7 +2,11 @@ const toobusy = require('toobusy-js') + const response = require('../../response') +const config = require('../../config') + +toobusy.maxLag(config.tooBusyLag) module.exports = function (req, res, next) { if (toobusy()) { -- cgit v1.2.3