139
140
// ComputeNextDelay returns the next delay interval. This is used by Retrier to delay calling the operation again
141
>
func (p *ExponentialRetryPolicy) ComputeNextDelay(elapsedTime time.Duration, numAttempts int, _ error) time.Duration {
retrypolicy.go
142
>
// Check to see if we ran out of maximum number of attempts
143
>
// NOTE: if maxAttempts is X, return done when numAttempts == X, otherwise there will be attempt X+1
144
>
if p.maximumAttempts != noMaximumAttempts && numAttempts >= p.maximumAttempts {
145
return done
146
}
147
148
// Stop retrying after expiration interval is elapsed
149
>
if p.expirationInterval != NoInterval && elapsedTime > p.expirationInterval {
retrypolicy.go
150
return done
151
}