mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): dont allow alert responses to cancel
This commit is contained in:
parent
0d86b8288d
commit
324b006c96
@ -95,10 +95,22 @@ func (e *Engine) processJob(grafanaCtx context.Context, job *Job) error {
|
||||
|
||||
job.Running = true
|
||||
evalContext := NewEvalContext(grafanaCtx, job.Rule)
|
||||
e.evalHandler.Eval(evalContext)
|
||||
e.resultHandler.Handle(evalContext)
|
||||
e.log.Debug("Job Execution completed", "timeMs", evalContext.GetDurationMs(), "alertId", evalContext.Rule.Id, "name", evalContext.Rule.Name, "firing", evalContext.Firing)
|
||||
evalDone := make(chan struct{})
|
||||
|
||||
go func() {
|
||||
e.evalHandler.Eval(evalContext)
|
||||
close(evalDone)
|
||||
}()
|
||||
|
||||
var err error = nil
|
||||
select {
|
||||
case <-grafanaCtx.Done():
|
||||
err = grafanaCtx.Err()
|
||||
case <-evalDone:
|
||||
err = e.resultHandler.Handle(evalContext)
|
||||
}
|
||||
|
||||
e.log.Debug("Job Execution completed", "timeMs", evalContext.GetDurationMs(), "alertId", evalContext.Rule.Id, "name", evalContext.Rule.Name, "firing", evalContext.Firing)
|
||||
job.Running = false
|
||||
return evalContext.Error
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user