Merge pull request #1901 from balena-os/report-errors

Only count report connectivity errors for healthcheck
This commit is contained in:
bulldozer-balena[bot] 2022-03-16 19:12:43 +00:00 committed by GitHub
commit 05fafae0b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,6 +173,9 @@ async function reportCurrentState(conf: CurrentStateReportConf) {
function handleRetry(retryInfo: OnFailureInfo) {
if (retryInfo.error instanceof StatusError) {
// We don't want these errors to be classed as a report error, as this will cause
// the watchdog to kill the supervisor - and killing the supervisor will
// not help in this situation
log.error(
`Device state report failure! Status code: ${retryInfo.error.statusCode} - message:`,
retryInfo.error?.message ?? retryInfo.error,
@ -181,8 +184,11 @@ function handleRetry(retryInfo: OnFailureInfo) {
eventTracker.track('Device state report failure', {
error: retryInfo.error?.message ?? retryInfo.error,
});
// Increase the counter so the healthcheck gets triggered
// if too many connectivity errors occur
stateReportErrors++;
}
stateReportErrors++;
log.info(
`Retrying current state report in ${retryInfo.delay / 1000} seconds`,
);