@@ -617,36 +617,36 @@ func (c *Client) retryHTTPCheck(ctx context.Context, resp *http.Response, err er
617
617
618
618
// retryHTTPBackoff provides a generic callback for Client.Backoff which
619
619
// will pass through all calls based on the status code of the response.
620
- func (c * Client ) retryHTTPBackoff (min , max time.Duration , attemptNum int , resp * http.Response ) time.Duration {
620
+ func (c * Client ) retryHTTPBackoff (minimum , maximum time.Duration , attemptNum int , resp * http.Response ) time.Duration {
621
621
if c .retryLogHook != nil {
622
622
c .retryLogHook (attemptNum , resp )
623
623
}
624
624
625
625
// Use the rate limit backoff function when we are rate limited.
626
626
if resp != nil && resp .StatusCode == 429 {
627
- return rateLimitBackoff (min , max , resp )
627
+ return rateLimitBackoff (minimum , maximum , resp )
628
628
}
629
629
630
630
// Set custom duration's when we experience a service interruption.
631
- min = 700 * time .Millisecond
632
- max = 900 * time .Millisecond
631
+ minimum = 700 * time .Millisecond
632
+ maximum = 900 * time .Millisecond
633
633
634
- return retryablehttp .LinearJitterBackoff (min , max , attemptNum , resp )
634
+ return retryablehttp .LinearJitterBackoff (minimum , maximum , attemptNum , resp )
635
635
}
636
636
637
637
// rateLimitBackoff provides a callback for Client.Backoff which will use the
638
638
// X-RateLimit_Reset header to determine the time to wait. We add some jitter
639
639
// to prevent a thundering herd.
640
640
//
641
- // min and max are mainly used for bounding the jitter that will be added to
641
+ // minimum and maximum are mainly used for bounding the jitter that will be added to
642
642
// the reset time retrieved from the headers. But if the final wait time is
643
- // less than min, min will be used instead.
644
- func rateLimitBackoff (min , max time.Duration , resp * http.Response ) time.Duration {
643
+ // less than minimum, minimum will be used instead.
644
+ func rateLimitBackoff (minimum , maximum time.Duration , resp * http.Response ) time.Duration {
645
645
// rnd is used to generate pseudo-random numbers.
646
646
rnd := rand .New (rand .NewSource (time .Now ().UnixNano ()))
647
647
648
648
// First create some jitter bounded by the min and max durations.
649
- jitter := time .Duration (rnd .Float64 () * float64 (max - min ))
649
+ jitter := time .Duration (rnd .Float64 () * float64 (maximum - minimum ))
650
650
651
651
if resp != nil && resp .Header .Get (_headerRateReset ) != "" {
652
652
v := resp .Header .Get (_headerRateReset )
@@ -655,12 +655,12 @@ func rateLimitBackoff(min, max time.Duration, resp *http.Response) time.Duration
655
655
log .Fatal (err )
656
656
}
657
657
// Only update min if the given time to wait is longer
658
- if reset > 0 && time .Duration (reset * 1e9 ) > min {
659
- min = time .Duration (reset * 1e9 )
658
+ if reset > 0 && time .Duration (reset * 1e9 ) > minimum {
659
+ minimum = time .Duration (reset * 1e9 )
660
660
}
661
661
}
662
662
663
- return min + jitter
663
+ return minimum + jitter
664
664
}
665
665
666
666
type rawAPIMetadata struct {
0 commit comments