mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 23:42:29 +00:00
Attempt a state report once every maxReportFrequency
With the addition of the system information feature (CPU temp) etc if there wasn't any changes in the docker or config state of the device, updates in system information would not be sent to the API. Now we attempt to send data once every maxReportFrequency (although this does not mean that we will be sending data that often, we still only send the delta, if one exists) Change-type: patch Closes: #1481 Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
975129188a
commit
0e3c026392
@ -243,12 +243,16 @@ const reportCurrentState = (): null => {
|
||||
};
|
||||
|
||||
export const startReporting = () => {
|
||||
deviceState.on('change', () => {
|
||||
const doReport = () => {
|
||||
if (!reportPending) {
|
||||
// A latency of 100ms should be acceptable and
|
||||
// allows avoiding catching docker at weird states
|
||||
reportCurrentState();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// If the state changes, report it
|
||||
deviceState.on('change', doReport);
|
||||
// But check once every max report frequency to ensure that changes in system
|
||||
// info are picked up (CPU temp etc)
|
||||
setInterval(doReport, constants.maxReportFrequency);
|
||||
return reportCurrentState();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user