Skip to content

Node.js based forum software built for the modern web

added toggler to disable toobusy if necessary

Julian Lam9589de551eea
diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js
index 9cc9d2d523..e2c5747ab6 100644
--- a/src/middleware/middleware.js
+++ b/src/middleware/middleware.js
@@ -221,7 +221,7 @@ middleware.privateUploads = function(req, res, next) {
};
middleware.busyCheck = function(req, res, next) {
- if (global.env === 'production' && toobusy()) {
+ if (global.env === 'production' && (!meta.config.hasOwnProperty('eventLoopCheckEnabled') || parseInt(meta.config.eventLoopCheckEnabled, 10) === 1) && toobusy()) {
res.type('text/html').sendFile(path.join(__dirname, '../../public/503.html'));
} else {
next();
diff --git a/src/views/admin/settings/advanced.tpl b/src/views/admin/settings/advanced.tpl
index 3a0a314106..b53cabacfb 100644
--- a/src/views/admin/settings/advanced.tpl
+++ b/src/views/admin/settings/advanced.tpl
@@ -50,6 +50,12 @@
point.
</p>
<form>
+ <div class="form-group">
+ <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="eventLoopCheckEnabled">
+ <input class="mdl-switch__input" id="eventLoopCheckEnabled" type="checkbox" data-field="eventLoopCheckEnabled" checked />
+ <span class="mdl-switch__label">Enable Traffic Management</span>
+ </label>
+ </div>
<div class="form-group">
<label for="eventLoopLagThreshold">Event Loop Lag Threshold (in milliseconds)</label>
<input class="form-control" id="eventLoopLagThreshold" type="number" data-field="eventLoopLagThreshold" placeholder="Default: 70" step="10" value="70" />