Merge pull request #1119 from balena-io/1117-vpn-rate-limit-fix

Ensure that we reset rate limits after a successful target apply
This commit is contained in:
CameronDiver 2019-10-29 11:11:39 +00:00 committed by GitHub
commit b64c5345a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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: =>