Skip to content

Commit

Permalink
Move initialization out of worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Pliner committed Feb 4, 2019
1 parent 76c177f commit 1d8aefd
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions notifier/selfstate/selfstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ type SelfCheckWorker struct {
}

func (selfCheck *SelfCheckWorker) selfStateChecker(stop <-chan struct{}) {
if !selfCheck.Config.Enabled {
selfCheck.Log.Debugf("Moira Self State Monitoring disabled")
return
}
senders := selfCheck.Notifier.GetSenders()
if err := selfCheck.Config.checkConfig(senders); err != nil {
selfCheck.Log.Errorf("Can't configure Moira Self State Monitoring: %s", err.Error())
return
}

selfCheck.Log.Info("Moira Notifier Self State Monitor started")

var metricsCount, checksCount, remoteChecksCount int64
Expand All @@ -70,6 +60,15 @@ func (selfCheck *SelfCheckWorker) selfStateChecker(stop <-chan struct{}) {

// Start self check worker
func (selfCheck *SelfCheckWorker) Start() error {
if !selfCheck.Config.Enabled {
selfCheck.Log.Debugf("Moira Self State Monitoring disabled")
return nil
}
senders := selfCheck.Notifier.GetSenders()
if err := selfCheck.Config.checkConfig(senders); err != nil {
selfCheck.Log.Errorf("Can't configure Moira Self State Monitoring: %s", err.Error())
return nil
}

selfCheck.tomb.Go(func() error {
w.NewWorker(
Expand Down

0 comments on commit 1d8aefd

Please sign in to comment.