Skip to content

Commit

Permalink
Fixed ppc64le-cloud#676: Validate conditions immediately upon invocat…
Browse files Browse the repository at this point in the history
…ion.

Fixed ppc64le-cloud#676: Validate conditions immediately upon invocation.
  • Loading branch information
aman4433 committed Sep 27, 2024
1 parent 8cc8376 commit c77e17b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ func PollUntil(pollInterval, timeOut <-chan time.Time, condition func() (bool, e
select {
case <-timeOut:
return fmt.Errorf("timed out while waiting for job to complete")
case <-pollInterval:
if done, err := condition(); err != nil {
default:
if done, err := condition(); err != nil || done {
return err
} else if done {
return nil
}
<-pollInterval
}
}
}

0 comments on commit c77e17b

Please sign in to comment.