Files
Igor Sirotin a2ac4a97d0 refactor: project layout (testutils, static, t) (#7223)
* refactor: delete unused files

* refactor: move emojis.txt to protocol/identity/emojihash

* chore: remove t/utils and unused t/config

* refactor: pks/testutils/fake

* refactor: remove unused t/helpers/peers.go

* refactor: move testutils to internal

* refactor: split testutils/fake

* refactor: moved t/helpers to internal/testutils

* fix: fake community
2025-12-17 15:21:08 +00:00

26 lines
551 B
Go

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