mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 23:42:29 +00:00
Fix exponential backoff for state polling
Change-type: patch
This commit is contained in:
parent
14bda050bd
commit
e37b52dd68
@ -141,13 +141,13 @@ const poll = async (
|
||||
// Try to fetch latest target state
|
||||
try {
|
||||
await update();
|
||||
// Reset fetchErrors because we successfuly updated
|
||||
fetchErrors = 0;
|
||||
} catch (e) {
|
||||
// Exponential back off if request fails
|
||||
pollInterval = Math.min(appUpdatePollInterval, 15000 * 2 ** fetchErrors);
|
||||
++fetchErrors;
|
||||
} finally {
|
||||
// Reset fetchErrors because we successfuly updated
|
||||
fetchErrors = 0;
|
||||
// Wait to poll again
|
||||
await delayedLoop(pollInterval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user