Browse Source

agent/checks: prevent overflow of backoff

pull/4320/head
Mitchell Hashimoto 6 years ago
parent
commit
9a90400821
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
  1. 6
      agent/checks/alias.go

6
agent/checks/alias.go

@ -120,7 +120,11 @@ func (c *CheckAlias) runQuery(stopCh chan struct{}) {
// Backoff if we have to
if attempt > checkAliasBackoffMin {
waitTime := (1 << (attempt - checkAliasBackoffMin)) * time.Second
shift := attempt - checkAliasBackoffMin
if shift > 31 {
shift = 31 // so we don't overflow to 0
}
waitTime := (1 << shift) * time.Second
if waitTime > checkAliasBackoffMaxWait {
waitTime = checkAliasBackoffMaxWait
}

Loading…
Cancel
Save