resources: Remove SetWatching/IsWatching code from Watch

This removes some boilerplate from the Watch methods which can be baked
into the engine instead.

This code should be checked for races and locks to make sure we only
start resources when it makes sense to.
This commit is contained in:
James Shubin
2016-12-11 23:00:20 -05:00
parent af47511d58
commit 067932aebf
13 changed files with 5 additions and 57 deletions

View File

@@ -289,6 +289,9 @@ func (g *Graph) Worker(v *Vertex) error {
// the Watch() function about which graph it is
// running on, which isolates things nicely...
obj := v.Res
// TODO: is there a better system for the `Watching` flag?
obj.SetWatching(true)
defer obj.SetWatching(false)
processChan := make(chan event.Event)
go func() {
running := false