diff --git a/engine/graph/engine.go b/engine/graph/engine.go index ae884801..5e4a1647 100644 --- a/engine/graph/engine.go +++ b/engine/graph/engine.go @@ -419,8 +419,10 @@ func (obj *Engine) Pause(fastPause bool) error { return nil } -// Close triggers a shutdown. Engine must be already paused before this is run. -func (obj *Engine) Close() error { +// Shutdown the engine. Engine must be already paused before this is run. It is +// actually just a Load of an empty graph and a Commit. It waits for all the +// resources to exit before returning. +func (obj *Engine) Shutdown() error { emptyGraph, reterr := pgraph.NewGraph("empty") // this is a graph switch (graph sync) that switches to an empty graph! diff --git a/lib/main.go b/lib/main.go index 9a9b174d..c7c5e2e4 100644 --- a/lib/main.go +++ b/lib/main.go @@ -506,7 +506,7 @@ func (obj *Main) Run() error { return errwrap.Wrapf(err, "engine Init failed") } defer func() { - err := errwrap.Wrapf(obj.ge.Close(), "engine Close failed") + err := errwrap.Wrapf(obj.ge.Shutdown(), "engine Shutdown failed") if err != nil { // TODO: cause the final exit code to be non-zero Logf("cleanup error: %+v", err) @@ -551,7 +551,7 @@ func (obj *Main) Run() error { obj.ge.Pause(false) } // must be paused before this is run - //obj.ge.Close() // run in defer instead + //obj.ge.Shutdown() // run in defer instead return // this is the only place we exit }