interruptible_wait: evaluate Predicate immediately
Previous behaviour was to wait PredicateInterval before the first time that the Predicate is evaluated
This commit is contained in:
parent
94dcf160df
commit
651274e508
@ -35,13 +35,14 @@ func (wait InterruptibleWait) Wait(state multistep.StateBag) error {
|
||||
|
||||
go func() {
|
||||
for {
|
||||
if complete, err := wait.Predicate(); err != nil || complete {
|
||||
predicateResult <- PredicateResult{complete, err}
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case <-time.After(wait.PredicateInterval):
|
||||
if complete, err := wait.Predicate(); err != nil || complete {
|
||||
predicateResult <- PredicateResult{complete, err}
|
||||
return
|
||||
}
|
||||
|
||||
// do nothing; loop again
|
||||
case <-stopWaiting:
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user