Update go-retryablehttp de

This commit is contained in:
Jeff Mitchell 2018-05-18 15:11:44 -04:00
parent 36837d8009
commit d991bc1917
2 changed files with 8 additions and 5 deletions

View file

@ -221,8 +221,11 @@ func LinearJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Resp
// Pick a random number that lies somewhere between the min and max and
// multiply by the attemptNum. attemptNum starts at zero so we always
// increment here.
return time.Duration((rand.Int63() % int64(max-min)) * int64(attemptNum))
// increment here. We first get a random percentage, then apply that to the
// difference between min and max, and add to min.
jitter := rand.Float64() * float64(max-min)
jitterMin := int64(jitter) + int64(min)
return time.Duration(jitterMin * int64(attemptNum))
}
// PassthroughErrorHandler is an ErrorHandler that directly passes through the

6
vendor/vendor.json vendored
View file

@ -1141,10 +1141,10 @@
"revisionTime": "2018-03-31T00:25:53Z"
},
{
"checksumSHA1": "3iOEPoU3QvetU5xPFTg+Oqsl+WU=",
"checksumSHA1": "QIiwrGGMyvIiBU6zcQlGKlA5V/c=",
"path": "github.com/hashicorp/go-retryablehttp",
"revision": "7d12bb7d610c15e57fbbe304084a87fe87574591",
"revisionTime": "2018-05-10T00:52:31Z"
"revision": "fac0f38bc25d8ef70e3c8d95c911d6062b6a94ec",
"revisionTime": "2018-05-18T19:11:07Z"
},
{
"checksumSHA1": "A1PcINvF3UiwHRKn8UcgARgvGRs=",