From 09875fe1603307080f3a4172985c5dca3bd9912d Mon Sep 17 00:00:00 2001 From: Duco van Amstel Date: Sun, 18 Nov 2018 17:55:05 +0000 Subject: Update direct dependencies where possible --- vendor/github.com/jpillora/backoff/README.md | 2 +- vendor/github.com/jpillora/backoff/backoff.go | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/jpillora') diff --git a/vendor/github.com/jpillora/backoff/README.md b/vendor/github.com/jpillora/backoff/README.md index 81e77cd7..ee4d6230 100644 --- a/vendor/github.com/jpillora/backoff/README.md +++ b/vendor/github.com/jpillora/backoff/README.md @@ -116,4 +116,4 @@ https://godoc.org/github.com/jpillora/backoff #### Credits -Forked from some JavaScript written by [@tj](https://github.com/tj) \ No newline at end of file +Forked from [some JavaScript](https://github.com/segmentio/backo) written by [@tj](https://github.com/tj) diff --git a/vendor/github.com/jpillora/backoff/backoff.go b/vendor/github.com/jpillora/backoff/backoff.go index a50d0e95..b4941b6e 100644 --- a/vendor/github.com/jpillora/backoff/backoff.go +++ b/vendor/github.com/jpillora/backoff/backoff.go @@ -71,7 +71,8 @@ func (b *Backoff) ForAttempt(attempt float64) time.Duration { //keep within bounds if dur < min { return min - } else if dur > max { + } + if dur > max { return max } return dur @@ -86,3 +87,13 @@ func (b *Backoff) Reset() { func (b *Backoff) Attempt() float64 { return b.attempt } + +// Copy returns a backoff with equals constraints as the original +func (b *Backoff) Copy() *Backoff { + return &Backoff{ + Factor: b.Factor, + Jitter: b.Jitter, + Min: b.Min, + Max: b.Max, + } +} -- cgit v1.2.3