From c94ccfb6deb6fb53a81526e5e626e3f6976e1592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kosch=C3=BCtzki?= Date: Mon, 21 Jul 2025 11:33:34 +0200 Subject: [PATCH] fix: Dont return toobusy errors for healthchecks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If running with an orchestrator that restarts hedgedoc on failing healthchecks, this causes it to enter a crashloop. toobusy -> gets restarted -> everyone refreshes -> toobusy Signed-off-by: Daniel Koschützki --- lib/web/middleware/tooBusy.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/web/middleware/tooBusy.js b/lib/web/middleware/tooBusy.js index a2101975..72020eda 100644 --- a/lib/web/middleware/tooBusy.js +++ b/lib/web/middleware/tooBusy.js @@ -8,6 +8,11 @@ const config = require('../../config') toobusy.maxLag(config.tooBusyLag) module.exports = function (req, res, next) { + // We dont want to return "toobusy" errors for healthchecks, as that + // will cause the process to be restarted + if (req.baseUrl === '/_health') { + next() + } if (toobusy()) { errors.errorServiceUnavailable(res) } else {