resources: Don't double close on Running restart

If we use the "retry" metaparam on a Watch, we want to avoid a double
close due to the second Running() signal. This avoids this with a simple
flag.
This commit is contained in:
James Shubin
2017-02-05 18:45:28 -05:00
parent b6772b7280
commit c247cd8fea
2 changed files with 6 additions and 2 deletions

View File

@@ -108,8 +108,11 @@ func (obj *BaseRes) Running(processChan chan *event.Event) error {
cuid.SetConverged(true) // a reasonable initial assumption
}
obj.StateOK(false) // assume we're initially dirty
close(obj.started) // send started signal
obj.StateOK(false) // assume we're initially dirty
if !obj.isStarted { // this avoids a double close when/if watch retries
obj.isStarted = true
close(obj.started) // send started signal
}
var err error
if obj.starter { // vertices of indegree == 0 should send initial pokes