190
}
191
192
>
func newClientRetryPolicy(initialInterval time.Duration, maxAttempts int, retryUnboundedOnSystemResourceExhausted func() bool) backoff.RetryPolicy {
util.go
193
>
capped := backoff.NewExponentialRetryPolicy(initialInterval).
194
>
WithMaximumAttempts(maxAttempts)
195
>
// No max-attempts cap; bounded by the default 1-minute expiration interval
196
>
// and the caller's context.
197
>
extended := backoff.NewExponentialRetryPolicy(initialInterval)
198
>
predicate := func(err error) bool {
199
>
return retryUnboundedOnSystemResourceExhausted() && isSystemResourceExhausted(err)
200
>
}
201
>
return backoff.NewConditionalRetryPolicy(predicate, extended, capped)
202
}
203