File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ func (s *Scheduler) syncAlertRules() {
149
149
for hash , rule := range alertRuleWorkers {
150
150
if _ , has := s .alertRules [hash ]; ! has {
151
151
rule .Prepare ()
152
+ time .Sleep (time .Duration (20 ) * time .Millisecond )
152
153
rule .Start ()
153
154
s .alertRules [hash ] = rule
154
155
}
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ import (
25
25
"github.com/ccfos/nightingale/v6/pkg/unit"
26
26
"github.com/ccfos/nightingale/v6/prom"
27
27
"github.com/prometheus/common/model"
28
- "golang.org/x/exp/rand"
29
28
30
29
"github.com/robfig/cron/v3"
31
30
"github.com/toolkits/pkg/logger"
@@ -137,14 +136,11 @@ func (arw *AlertRuleWorker) Prepare() {
137
136
}
138
137
139
138
func (arw * AlertRuleWorker ) Start () {
140
- randomWait := time .Duration (rand .Intn (60000 )) * time .Millisecond
141
- time .Sleep (randomWait )
142
-
143
- logger .Infof ("eval:%s started after waiting %d ms" , arw .Key (), randomWait )
144
139
arw .Scheduler .Start ()
145
140
}
146
141
147
142
func (arw * AlertRuleWorker ) Eval () {
143
+ logger .Infof ("eval:%s started" , arw .Key ())
148
144
if arw .Processor .PromEvalInterval == 0 {
149
145
arw .Processor .PromEvalInterval = getPromEvalInterval (arw .Processor .ScheduleEntry .Schedule )
150
146
}
You can’t perform that action at this time.
0 commit comments