fix: Dont return toobusy errors for healthchecks.

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 <daniel.koschuetzki@adfinis.com>
This commit is contained in:
Daniel Koschützki
2025-07-21 11:33:34 +02:00
committed by Erik Michelson
parent eba0fc51f0
commit c94ccfb6de

View File

@@ -8,6 +8,11 @@ const config = require('../../config')
toobusy.maxLag(config.tooBusyLag) toobusy.maxLag(config.tooBusyLag)
module.exports = function (req, res, next) { 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()) { if (toobusy()) {
errors.errorServiceUnavailable(res) errors.errorServiceUnavailable(res)
} else { } else {