mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
26 lines
503 B
Go
26 lines
503 B
Go
package twitter
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/cenkalti/backoff"
|
|
)
|
|
|
|
func newExponentialBackOff() *backoff.ExponentialBackOff {
|
|
b := backoff.NewExponentialBackOff()
|
|
b.InitialInterval = 5 * time.Second
|
|
b.Multiplier = 2.0
|
|
b.MaxInterval = 320 * time.Second
|
|
b.Reset()
|
|
return b
|
|
}
|
|
|
|
func newAggressiveExponentialBackOff() *backoff.ExponentialBackOff {
|
|
b := backoff.NewExponentialBackOff()
|
|
b.InitialInterval = 1 * time.Minute
|
|
b.Multiplier = 2.0
|
|
b.MaxInterval = 16 * time.Minute
|
|
b.Reset()
|
|
return b
|
|
}
|