Update retryable dep
This commit is contained in:
parent
a287830985
commit
2cc9b7fc72
28
vendor/github.com/hashicorp/go-retryablehttp/client.go
generated
vendored
28
vendor/github.com/hashicorp/go-retryablehttp/client.go
generated
vendored
|
@ -192,19 +192,37 @@ func DefaultBackoff(min, max time.Duration, attemptNum int, resp *http.Response)
|
||||||
|
|
||||||
// LinearJitterBackoff provides a callback for Client.Backoff which will
|
// LinearJitterBackoff provides a callback for Client.Backoff which will
|
||||||
// perform linear backoff based on the attempt number and with jitter to
|
// perform linear backoff based on the attempt number and with jitter to
|
||||||
// prevent a thundering herd. The final backoff time is the attempt number
|
// prevent a thundering herd.
|
||||||
// multiplied by the random chosen value between min/max.
|
//
|
||||||
|
// min and max here are *not* absolute values. The number to be multipled by
|
||||||
|
// the attempt number will be chosen at random from between them, thus they are
|
||||||
|
// bounding the jitter.
|
||||||
|
//
|
||||||
|
// For instance:
|
||||||
|
// * To get strictly linear backoff of one second increasing each retry, set
|
||||||
|
// both to one second (1s, 2s, 3s, 4s, ...)
|
||||||
|
// * To get a small amount of jitter centered around one second increasing each
|
||||||
|
// retry, set to around one second, such as a min of 800ms and max of 1200ms
|
||||||
|
// (892ms, 2102ms, 2945ms, 4312ms, ...)
|
||||||
|
// * To get extreme jitter, set to a very wide spread, such as a min of 100ms
|
||||||
|
// and a max of 20s (15382ms, 292ms, 51321ms, 35234ms, ...)
|
||||||
func LinearJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
|
func LinearJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
|
||||||
|
// attemptNum always starts at zero but we want to start at 1 for multiplication
|
||||||
|
attemptNum++
|
||||||
|
|
||||||
if max <= min {
|
if max <= min {
|
||||||
// Unclear what to do here, so return min
|
// Unclear what to do here, or they are the same, so return min *
|
||||||
return min
|
// attemptNum
|
||||||
|
return min * attemptNum
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seed rand; doing this every time is fine
|
// Seed rand; doing this every time is fine
|
||||||
rand := rand.New(rand.NewSource(int64(time.Now().Nanosecond())))
|
rand := rand.New(rand.NewSource(int64(time.Now().Nanosecond())))
|
||||||
|
|
||||||
// Pick a random number that lies somewhere between the min and max and
|
// Pick a random number that lies somewhere between the min and max and
|
||||||
// multiply by the attemptNum. attemptNum starts at zero so we always
|
// multiply by the attemptNum. attemptNum starts at zero so we always
|
||||||
// increment here.
|
// increment here.
|
||||||
return (min + time.Duration(int64(rand.Int63())%int64(max-min))) * time.Duration(attemptNum+1)
|
return time.Duration((rand.Int63() % int64(max-min)) * attemptNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PassthroughErrorHandler is an ErrorHandler that directly passes through the
|
// PassthroughErrorHandler is an ErrorHandler that directly passes through the
|
||||||
|
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
@ -1141,10 +1141,10 @@
|
||||||
"revisionTime": "2018-03-31T00:25:53Z"
|
"revisionTime": "2018-03-31T00:25:53Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "xCptnjI2GVTNvx+Td5enr9jvk4w=",
|
"checksumSHA1": "Zg/eHcBFPznCeqiRBQeV8WQw9G8=",
|
||||||
"path": "github.com/hashicorp/go-retryablehttp",
|
"path": "github.com/hashicorp/go-retryablehttp",
|
||||||
"revision": "0936e5acf1e32bbc3c210de331a1aefb3a2113bc",
|
"revision": "936ce55c28f313d8cf79061ffcb25a55bf631eb6",
|
||||||
"revisionTime": "2018-05-09T22:33:19Z"
|
"revisionTime": "2018-05-10T00:49:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "A1PcINvF3UiwHRKn8UcgARgvGRs=",
|
"checksumSHA1": "A1PcINvF3UiwHRKn8UcgARgvGRs=",
|
||||||
|
|
Loading…
Reference in a new issue