Skip to content

Commit 6197717

Browse files
committed
ETIMEDOUT is now unhealthy instead of down
1 parent cb1b121 commit 6197717

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/health-check.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,17 @@ class HealthCheck {
236236
service.status.count.unhealthy++;
237237
}
238238
} catch (e) {
239-
service.status.time =
240-
Number(process.hrtime.bigint() - startTime) / 1000000;
241-
service.status.count.down++;
242-
service.status.up = -1;
243-
service.status.code = 0;
239+
if (e.message.indexOf('ETIMEDOUT') > -1) {
240+
service.status.up = 0;
241+
service.status.count.unhealthy++;
242+
log.info(service.name, ' Unhealthy ETIMEDOUT!');
243+
} else {
244+
service.status.time =
245+
Number(process.hrtime.bigint() - startTime) / 1000000;
246+
service.status.count.down++;
247+
service.status.up = -1;
248+
service.status.code = 0;
249+
}
244250

245251
log.debug(service.name, e.message);
246252
}

0 commit comments

Comments
 (0)