From 2a3608df533fbac4ec41e0be094614c7684319a7 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 18 Nov 2020 12:19:08 -0600 Subject: [PATCH] Skip heartbeat on /healthz endpoint (#2333) 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 5bb62d1e..8a073a31 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