Skip to content

Commit

Permalink
fix: use safer condition
Browse files Browse the repository at this point in the history
Without the previous fix, Retry.Max == 0 would potentially loop
on retryable errors. This is bad so even though it shouldn't happen
now. Make the condition safer.

Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
Signed-off-by: Ioan Zicu <ioan.zicu@nokia.com>
  • Loading branch information
hindessm authored and Ioan Zicu committed Jul 31, 2023
1 parent bfb70cf commit 9553cc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (ca *clusterAdmin) retryOnError(retryable func(error) bool, fn func() error
for attemptsRemaining := ca.conf.Admin.Retry.Max + 1; ; {
err := fn()
attemptsRemaining--
if err == nil || attemptsRemaining == 0 || !retryable(err) {
if err == nil || attemptsRemaining <= 0 || !retryable(err) {
return err
}
Logger.Printf(
Expand Down

0 comments on commit 9553cc8

Please sign in to comment.