status-go/protocol/tt/backoff.go
Pedro Pombeiro ed5a5c154d
Move to monorepo structure (#1684)
Move to a monorepo structure with submodules

- Rename status-protocol-go to status-go/protocol
2019-11-21 17:19:22 +01:00

21 lines
414 B
Go

package tt
import (
"time"
"github.com/cenkalti/backoff/v3"
)
func RetryWithBackOff(o func() error) error {
b := backoff.ExponentialBackOff{
InitialInterval: time.Millisecond * 100,
RandomizationFactor: 0.1,
Multiplier: 1,
MaxInterval: time.Second,
MaxElapsedTime: time.Second * 10,
Clock: backoff.SystemClock,
}
b.Reset()
return backoff.Retry(o, &b)
}