Skip to content

Commit 4cd3a9b

Browse files
craig[bot]kev-cao
andcommitted
Merge #150337
150337: util: update comment for retry r=dt a=kev-cao This commit updates the documentation for `util.Retry` to clarify the behavior if both `MaxRetry` and `MaxDuration` is set. Epic: None Release note: None Co-authored-by: Kevin Cao <[email protected]>
2 parents d7cdba0 + b83a06c commit 4cd3a9b

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)