pgraph: Simplify graph exit waiting

I think the vertex resource exiting can be done in a single stage
instead of the previous two stage exit.
This commit is contained in:
James Shubin
2016-12-20 05:08:34 -05:00
parent 0009d9b20e
commit 2c8c9264a4
2 changed files with 3 additions and 9 deletions

View File

@@ -540,11 +540,11 @@ func (obj *Main) Run() error {
reterr = multierr.Append(reterr, err) // list of errors
}
G.Exit() // tell all the children to exit
// tell inner main loop to exit
close(exitchan)
G.Exit() // tell all the children to exit, and waits for them to do so
// cleanup etcd main loop last so it can process everything first
if err := EmbdEtcd.Destroy(); err != nil { // shutdown and cleanup etcd
err = errwrap.Wrapf(err, "Etcd exited poorly!")
@@ -555,8 +555,6 @@ func (obj *Main) Run() error {
log.Printf("Main: Graph: %v", G)
}
G.Wait() // wait for the graph vertex worker goroutines to exit
// TODO: wait for each vertex to exit...
log.Println("Goodbye!")
return reterr