diff --git a/sectorstatemgr/sectorstatemgr.go b/sectorstatemgr/sectorstatemgr.go index dddce8889..7acf0ad11 100644 --- a/sectorstatemgr/sectorstatemgr.go +++ b/sectorstatemgr/sectorstatemgr.go @@ -61,6 +61,7 @@ func NewSectorStateMgr(cfg *config.Boost) func(lc fx.Lifecycle, sdb *db.SectorSt }, OnStop: func(ctx context.Context) error { cancel() + mgr.PubSub.Close() return nil }, }) @@ -72,8 +73,6 @@ func NewSectorStateMgr(cfg *config.Boost) func(lc fx.Lifecycle, sdb *db.SectorSt func (m *SectorStateMgr) Run(ctx context.Context) { duration := time.Duration(m.cfg.StorageListRefreshDuration) log.Infof("starting sector state manager running on interval %s", duration.String()) - ticker := time.NewTicker(duration) - defer ticker.Stop() // Check immediately err := m.checkForUpdates(ctx) @@ -81,6 +80,9 @@ func (m *SectorStateMgr) Run(ctx context.Context) { log.Errorw("checking for state updates", "err", err) } + ticker := time.NewTicker(duration) + defer ticker.Stop() + // Check every tick for { select {