Skip to content

Commit b83a06c

Browse files
committed
util: update comment for retry
This commit updates the documentation for `util.Retry` to clarify the behavior if both `MaxRetry` and `MaxDuration` is set.
1 parent 97b5668 commit b83a06c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/util/retry/retry.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ type Options struct {
2525
RandomizationFactor float64
2626
Closer <-chan struct{} // Optionally end retry loop channel close
2727
// Maximum number of retries; attempts = MaxRetries + 1. (0 for infinite)
28+
//
29+
// If both MaxRetries and MaxDuration are set, the loop will stop when the
30+
// first of the two conditions is met.
2831
MaxRetries int
2932
// MaxDuration is the maximum duration for which the retry loop will make
3033
// attempts. Once the deadline has elapsed, the loop will stop attempting
3134
// retries.
3235
// The loop will run for at least one iteration. (0 for infinite)
36+
//
37+
// If both MaxRetries and MaxDuration are set, the loop will stop when the
38+
// first of the two conditions is met.
3339
MaxDuration time.Duration
3440
// PreemptivelyCancel indicates whether the retry loop should cancel itself if
3541
// it determines that the next backoff would exceed the MaxDuration.

0 commit comments

Comments
 (0)