mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
use router.Stop
This commit is contained in:
@@ -103,9 +103,7 @@ func run(ctx context.Context, c *cli.Command) error {
|
|||||||
|
|
||||||
commandLogger := slog.Default().With("component", "cmd")
|
commandLogger := slog.Default().With("component", "cmd")
|
||||||
|
|
||||||
routerContext, routerCancel := context.WithCancel(context.Background())
|
router, moduleErrors, routeErrors := showbridge.NewRouter(context.Background(), config)
|
||||||
|
|
||||||
router, moduleErrors, routeErrors := showbridge.NewRouter(routerContext, config)
|
|
||||||
|
|
||||||
for _, moduleError := range moduleErrors {
|
for _, moduleError := range moduleErrors {
|
||||||
commandLogger.Error("problem initializing module", "index", moduleError.Index, "error", moduleError.Error)
|
commandLogger.Error("problem initializing module", "index", moduleError.Index, "error", moduleError.Error)
|
||||||
@@ -123,7 +121,7 @@ func run(ctx context.Context, c *cli.Command) error {
|
|||||||
|
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
commandLogger.Debug("shutting down router")
|
commandLogger.Debug("shutting down router")
|
||||||
routerCancel()
|
router.Stop()
|
||||||
commandLogger.Debug("waiting for router to exit")
|
commandLogger.Debug("waiting for router to exit")
|
||||||
routerRunner.Wait()
|
routerRunner.Wait()
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user