From 51c3709e824a3687e9c5aff1259f58998362c7b6 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 18 Nov 2020 10:25:37 -0600 Subject: [PATCH] Skip heartbeat on /healthz endpoint I managed to lose this in the rewrite. Fixes #2327. --- src/node/routes/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node/routes/index.ts b/src/node/routes/index.ts index 2c54917dabed..6f27b506bd6c 100644 --- a/src/node/routes/index.ts +++ b/src/node/routes/index.ts @@ -66,7 +66,11 @@ export const register = async ( app.use(bodyParser.urlencoded({ extended: true })) const common: express.RequestHandler = (req, _, next) => { - heart.beat() + // /healthz|/healthz/ needs to be excluded otherwise health checks will make + // it look like code-server is always in use. + if (!/^\/healthz\/?$/.test(req.url)) { + heart.beat() + } // Add common variables routes can use. req.args = args