mirror of
https://github.com/grafana/grafana.git
synced 2026-08-18 17:15:08 -05:00
Alerting: Ticker to support stopping (#48142)
* add stop for ticker * stop ticker when scheduler stops * stop ticker when legacy engine stops
This commit is contained in:
@@ -59,6 +59,7 @@ Scopes must have an order to ensure consistency and ease of search, this helps u
|
||||
- [BUGFIX] RBAC: replace create\update\delete actions for notification policies by alert.notifications:write #49185
|
||||
- [BUGFIX] Fix access to alerts for Viewer role with editor permissions in folder #49270
|
||||
- [FEATURE] Alert rules with associated panels will take screenshots. #49293 #49338 #49374 #49377 #49378 #49379 #49381 #49385 #49439 #49445
|
||||
- [ENHANCEMENT] Scheduler: ticker to support stopping #48142
|
||||
|
||||
## 8.5.3
|
||||
|
||||
@@ -81,4 +82,3 @@ Scopes must have an order to ensure consistency and ease of search, this helps u
|
||||
- [BUGFIX] (Legacy) Templates: Parse notification templates using all the matches of the alert rule when going from `Alerting` to `OK` in legacy alerting #47355
|
||||
- [BUGFIX] Scheduler: Fix state manager to support OK option of `AlertRule.ExecErrState` #47670
|
||||
- [ENHANCEMENT] Templates: Enable the use of classic condition values in templates #46971
|
||||
|
||||
|
||||
@@ -156,6 +156,8 @@ func (sch *schedule) Run(ctx context.Context) error {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
defer sch.ticker.Stop()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
if err := sch.schedulePeriodic(ctx); err != nil {
|
||||
@@ -652,6 +654,7 @@ func (sch *schedule) saveAlertStates(ctx context.Context, states []*state.State)
|
||||
func (sch *schedule) overrideCfg(cfg SchedulerCfg) {
|
||||
sch.clock = cfg.C
|
||||
sch.baseInterval = cfg.BaseInterval
|
||||
sch.ticker.Stop()
|
||||
sch.ticker = alerting.NewTicker(cfg.C, cfg.BaseInterval, cfg.Metrics.Ticker)
|
||||
sch.evalAppliedFunc = cfg.EvalAppliedFunc
|
||||
sch.stopAppliedFunc = cfg.StopAppliedFunc
|
||||
|
||||
Reference in New Issue
Block a user