Fix exponential backoff for api.LifetimeWatcher (#26383)

* Fix exponential backoff for api.LifetimeWatcher

* Add changelog entry
This commit is contained in:
Andrew Stucki
2024-04-12 12:59:58 -04:00
committed by GitHub
parent e94163e475
commit 57cb563be5
2 changed files with 8 additions and 2 deletions

View File

@@ -349,8 +349,11 @@ func (r *LifetimeWatcher) doRenewWithOptions(tokenMode bool, nonRenewable bool,
if errorBackoff == nil { if errorBackoff == nil {
sleepDuration = r.calculateSleepDuration(remainingLeaseDuration, priorDuration) sleepDuration = r.calculateSleepDuration(remainingLeaseDuration, priorDuration)
} else if errorBackoff.NextBackOff() == backoff.Stop { } else {
return err sleepDuration = errorBackoff.NextBackOff()
if sleepDuration == backoff.Stop {
return err
}
} }
// remainingLeaseDuration becomes the priorDuration for the next loop // remainingLeaseDuration becomes the priorDuration for the next loop

3
changelog/26383.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
api: fixed a bug where LifetimeWatcher routines weren't respecting exponential backoff in the presence of unexpected errors
```