Skip to content

Commit

Permalink
ETIMEDOUT is now unhealthy instead of down
Browse files Browse the repository at this point in the history
  • Loading branch information
Phara0h committed Nov 4, 2020
1 parent cb1b121 commit 6197717
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/health-check.js
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6197717

Please sign in to comment.