mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-24 07:46:41 +00:00
Merge pull request #1367 from balena-io/fix-state-fetch-backoff
Fix exponential backoff for state polling
This commit is contained in:
commit
507cb33c6a
@ -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