Skip to content

Commit

Permalink
retry: Sleep after failure
Browse files Browse the repository at this point in the history
This way if the condition is true in the first iteration we exit immediately.

Signed-off-by: Jeremi Piotrowski <[email protected]>
  • Loading branch information
jepio committed Mar 5, 2025
1 parent 3576b9f commit 2328e2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ func WaitUntilReady(timeout, delay time.Duration, checkFunction func() (bool, er
default:
}

time.Sleep(delay)

done, err := checkFunction()
if err != nil {
return err
Expand All @@ -67,6 +65,8 @@ func WaitUntilReady(timeout, delay time.Duration, checkFunction func() (bool, er
if done {
break
}

time.Sleep(delay)
}
return nil
}

0 comments on commit 2328e2f

Please sign in to comment.