From 3406017754b4da48bb6bb6d6caf7f01fd45da339 Mon Sep 17 00:00:00 2001 From: Alexandr Stelnykovych Date: Tue, 11 Nov 2025 17:17:26 +0200 Subject: [PATCH] Refactor status module initialization: register runtime privider as soon as possible --- service/status/module.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/service/status/module.go b/service/status/module.go index 77ec6716..1d94d19d 100644 --- a/service/status/module.go +++ b/service/status/module.go @@ -35,10 +35,6 @@ func (s *Status) Manager() *mgr.Manager { // Start starts the module. func (s *Status) Start() error { - if err := s.setupRuntimeProvider(); err != nil { - return err - } - s.mgr.Go("status publisher", s.statusPublisher) s.instance.NetEnv().EventOnlineStatusChange.AddCallback("update online status in system status", @@ -67,6 +63,14 @@ func (s *Status) Stop() error { return nil } +func (s *Status) prep() error { + // register status provider as soon as possible + if err := s.setupRuntimeProvider(); err != nil { + return err + } + return nil +} + // AddToDebugInfo adds the system status to the given debug.Info. func AddToDebugInfo(di *debug.Info) { di.AddSection( @@ -96,6 +100,10 @@ func New(instance instance) (*Status, error) { notifications: make(map[string]map[string]*notifications.Notification), } + if err := module.prep(); err != nil { + return nil, err + } + return module, nil }