mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-22 10:21:01 +00:00
Merge pull request #1008 from balena-io/fix-bad-report
Don't drop failed api patch data
This commit is contained in:
commit
d8eeba3d46
@ -501,24 +501,27 @@ export class APIBinder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Bluebird.resolve(
|
try {
|
||||||
this.sendReportPatch(stateDiff, { apiEndpoint, uuid }),
|
await Bluebird.resolve(
|
||||||
)
|
this.sendReportPatch(stateDiff, { apiEndpoint, uuid }),
|
||||||
.catch(StatusError, (e: StatusError) => {
|
).timeout(conf.apiTimeout);
|
||||||
|
|
||||||
|
this.stateReportErrors = 0;
|
||||||
|
_.assign(this.lastReportedState.local, stateDiff.local);
|
||||||
|
_.assign(this.lastReportedState.dependent, stateDiff.dependent);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof StatusError) {
|
||||||
// We don't want this to be classed as a report error, as this will cause
|
// We don't want this to be classed as a report error, as this will cause
|
||||||
// the watchdog to kill the supervisor - and killing the supervisor will
|
// the watchdog to kill the supervisor - and killing the supervisor will
|
||||||
// not help in this situation
|
// not help in this situation
|
||||||
log.error(
|
log.error(
|
||||||
`Non-200 response from API! Status code: ${e.statusCode} - message: ${
|
'Non-200 response from the API! Status code: ${e.statusCode} - message:',
|
||||||
e.message
|
e,
|
||||||
}`,
|
|
||||||
);
|
);
|
||||||
})
|
} else {
|
||||||
.timeout(conf.apiTimeout);
|
throw e;
|
||||||
|
}
|
||||||
this.stateReportErrors = 0;
|
}
|
||||||
_.assign(this.lastReportedState.local, stateDiff.local);
|
|
||||||
_.assign(this.lastReportedState.dependent, stateDiff.dependent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private reportCurrentState(): null {
|
private reportCurrentState(): null {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user