mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
fix RunWithNetRetry (#8590)
This commit is contained in:
parent
952ede4f73
commit
437b1832dd
@ -76,10 +76,15 @@ func Retryable(err error) bool {
|
||||
|
||||
// RunWithNetRetry runs the given function and retries in case of network errors (see Retryable).
|
||||
func RunWithNetRetry(t *testing.T, fn func() error) error {
|
||||
return retry.Do(func() error {
|
||||
if err := fn(); err != nil && Retryable(err) {
|
||||
var err error
|
||||
// Do cannot return a non-nil error here.
|
||||
_ = retry.Do(func() error {
|
||||
err = fn()
|
||||
if err != nil && Retryable(err) {
|
||||
t.Logf("%s: retrying error: %s", t.Name(), err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}, retry.WithInterval(5*time.Second))
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user