fix(shutdown): fix crash when shutting down before server and task scheduler have started. (#2148)

init shutdown routine after controller.Init()
check for nil values before stopping http server and task scheduler.

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2024-01-06 03:50:48 +02:00
committed by GitHub
parent 59f41ac17d
commit a46e10269a
3 changed files with 10 additions and 7 deletions
+2
View File
@@ -69,6 +69,8 @@ func newServeCmd(conf *config.Config) *cobra.Command {
return err
}
initShutDownRoutine(ctlr)
if err := ctlr.Run(); err != nil {
log.Error().Err(err).Msg("failed to start controller, exiting")
}