Ensure that we reset rate limits after a successful target apply

Change-type: patch
Closes: #1117
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-10-28 11:54:11 +00:00
parent 424e1f69ca
commit 9651bc7028
No known key found for this signature in database
GPG Key ID: 49690ED87032539F
2 changed files with 10 additions and 0 deletions

View File

@ -324,6 +324,12 @@ export class DeviceConfig {
);
}
public resetRateLimits() {
_.each(this.rateLimits, action => {
action.lastAttempt = null;
});
}
private bootConfigChangeRequired(
configBackend: DeviceConfigBackend | null,
current: Dictionary<string>,

View File

@ -146,6 +146,10 @@ module.exports = class DeviceState extends EventEmitter
log.error('Device state apply error', err)
else
log.success('Device state apply success')
# We also let the device-config module know that we
# successfully reached the target state and that it
# should clear any rate limiting it's applied
@deviceConfig.resetRateLimits()
@applications.on('change', @reportCurrentState)
healthcheck: =>