summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/jpillora/backoff/backoff.go
diff options
context:
space:
mode:
authorDuco van Amstel <helcaraxan@gmail.com>2018-11-18 17:55:05 +0000
committerWim <wim@42.be>2018-11-25 21:21:04 +0100
commit09875fe1603307080f3a4172985c5dca3bd9912d (patch)
treea23220772f6f6597d509ca71b2df3480a77b8076 /vendor/github.com/jpillora/backoff/backoff.go
parentf716b8fc0ff90f47b61e218ef34019b38bd70e0d (diff)
downloadmatterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.tar.gz
matterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.tar.bz2
matterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.zip
Update direct dependencies where possible
Diffstat (limited to 'vendor/github.com/jpillora/backoff/backoff.go')
-rw-r--r--vendor/github.com/jpillora/backoff/backoff.go13
1 files changed, 12 insertions, 1 deletions
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,
+ }
+}