mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 18:06:47 +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(
|
||||
this.sendReportPatch(stateDiff, { apiEndpoint, uuid }),
|
||||
)
|
||||
.catch(StatusError, (e: StatusError) => {
|
||||
try {
|
||||
await Bluebird.resolve(
|
||||
this.sendReportPatch(stateDiff, { apiEndpoint, uuid }),
|
||||
).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
|
||||
// the watchdog to kill the supervisor - and killing the supervisor will
|
||||
// not help in this situation
|
||||
log.error(
|
||||
`Non-200 response from API! Status code: ${e.statusCode} - message: ${
|
||||
e.message
|
||||
}`,
|
||||
'Non-200 response from the API! Status code: ${e.statusCode} - message:',
|
||||
e,
|
||||
);
|
||||
})
|
||||
.timeout(conf.apiTimeout);
|
||||
|
||||
this.stateReportErrors = 0;
|
||||
_.assign(this.lastReportedState.local, stateDiff.local);
|
||||
_.assign(this.lastReportedState.dependent, stateDiff.dependent);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private reportCurrentState(): null {
|
||||
|
Loading…
x
Reference in New Issue
Block a user