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:
Cheng Sun 2014-12-09 14:50:44 +00:00
parent 94dcf160df
commit 651274e508

View File

@ -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
}