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() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
if complete, err := wait.Predicate(); err != nil || complete {
|
||||||
|
predicateResult <- PredicateResult{complete, err}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(wait.PredicateInterval):
|
case <-time.After(wait.PredicateInterval):
|
||||||
if complete, err := wait.Predicate(); err != nil || complete {
|
// do nothing; loop again
|
||||||
predicateResult <- PredicateResult{complete, err}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-stopWaiting:
|
case <-stopWaiting:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user