lib, engine: graph: Rename the Close method

This commit is contained in:
James Shubin
2023-08-30 20:45:52 -04:00
parent 7288e5d4a4
commit c06cf44fd7
2 changed files with 6 additions and 4 deletions

View File

@@ -419,8 +419,10 @@ func (obj *Engine) Pause(fastPause bool) error {
return nil return nil
} }
// Close triggers a shutdown. Engine must be already paused before this is run. // Shutdown the engine. Engine must be already paused before this is run. It is
func (obj *Engine) Close() error { // 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") emptyGraph, reterr := pgraph.NewGraph("empty")
// this is a graph switch (graph sync) that switches to an empty graph! // this is a graph switch (graph sync) that switches to an empty graph!

View File

@@ -506,7 +506,7 @@ func (obj *Main) Run() error {
return errwrap.Wrapf(err, "engine Init failed") return errwrap.Wrapf(err, "engine Init failed")
} }
defer func() { defer func() {
err := errwrap.Wrapf(obj.ge.Close(), "engine Close failed") err := errwrap.Wrapf(obj.ge.Shutdown(), "engine Shutdown failed")
if err != nil { if err != nil {
// TODO: cause the final exit code to be non-zero // TODO: cause the final exit code to be non-zero
Logf("cleanup error: %+v", err) Logf("cleanup error: %+v", err)
@@ -551,7 +551,7 @@ func (obj *Main) Run() error {
obj.ge.Pause(false) obj.ge.Pause(false)
} }
// must be paused before this is run // 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 return // this is the only place we exit
} }