diff --git a/service/instance.go b/service/instance.go index 8eab70eb..ad6e9dab 100644 --- a/service/instance.go +++ b/service/instance.go @@ -619,7 +619,7 @@ func (i *Instance) shutdown(exitCode int) { // Stopping returns whether the instance is shutting down. func (i *Instance) Stopping() bool { - return i.ctx.Err() == nil + return i.ctx.Err() != nil } // Stopped returns a channel that is triggered when the instance has shut down. diff --git a/spn/access/module.go b/spn/access/module.go index 2b076586..d49524f9 100644 --- a/spn/access/module.go +++ b/spn/access/module.go @@ -86,22 +86,24 @@ func start() error { enabled := config.GetAsBool("spn/enable", false) if enabled() { + log.Info("spn: starting SPN") module.mgr.Go("ensure SPN is started", module.instance.SPNGroup().EnsureStartedWorker) } else { + log.Info("spn: stopping SPN") module.mgr.Go("ensure SPN is stopped", module.instance.SPNGroup().EnsureStoppedWorker) } return false, nil }) + // Load tokens from database. + loadTokens() + // Check if we need to enable SPN now. enabled := config.GetAsBool("spn/enable", false) if enabled() { module.mgr.Go("ensure SPN is started", module.instance.SPNGroup().EnsureStartedWorker) } - // Load tokens from database. - loadTokens() - // Register new task. module.updateAccountWorkerMgr.Delay(1 * time.Minute) }