From 61977172f631ea3517cbf04d3b1056fb6d4e9f38 Mon Sep 17 00:00:00 2001 From: Phara0h Date: Wed, 4 Nov 2020 14:44:58 -0500 Subject: [PATCH] ETIMEDOUT is now `unhealthy` instead of `down` --- src/health-check.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/health-check.js b/src/health-check.js index 85c6786..0b48565 100644 --- a/src/health-check.js +++ b/src/health-check.js @@ -236,11 +236,17 @@ class HealthCheck { service.status.count.unhealthy++; } } catch (e) { - service.status.time = - Number(process.hrtime.bigint() - startTime) / 1000000; - service.status.count.down++; - service.status.up = -1; - service.status.code = 0; + if (e.message.indexOf('ETIMEDOUT') > -1) { + service.status.up = 0; + service.status.count.unhealthy++; + log.info(service.name, ' Unhealthy ETIMEDOUT!'); + } else { + service.status.time = + Number(process.hrtime.bigint() - startTime) / 1000000; + service.status.count.down++; + service.status.up = -1; + service.status.code = 0; + } log.debug(service.name, e.message); }