mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
style(go_routines): improve variable naming
This commit is contained in:
@@ -60,10 +60,10 @@ func main() {
|
||||
setting.BuildCommit = commit
|
||||
setting.BuildStamp = buildstampInt64
|
||||
|
||||
appContext, cancelFn := context.WithCancel(context.Background())
|
||||
grafanaGroup, _ := errgroup.WithContext(appContext)
|
||||
appContext, shutdownFn := context.WithCancel(context.Background())
|
||||
grafanaGroup, appContext := errgroup.WithContext(appContext)
|
||||
|
||||
go listenToSystemSignals(cancelFn, grafanaGroup)
|
||||
go listenToSystemSignals(shutdownFn, grafanaGroup)
|
||||
|
||||
flag.Parse()
|
||||
writePIDFile()
|
||||
|
||||
@@ -39,7 +39,7 @@ func NewEngine() *Engine {
|
||||
func (e *Engine) Start(grafanaCtx context.Context) error {
|
||||
e.log.Info("Starting Alerting Engine")
|
||||
|
||||
g, _ := errgroup.WithContext(grafanaCtx)
|
||||
g, grafanaCtx := errgroup.WithContext(grafanaCtx)
|
||||
|
||||
g.Go(func() error { return e.alertingTicker(grafanaCtx) })
|
||||
g.Go(func() error { return e.execDispatcher(grafanaCtx) })
|
||||
@@ -90,7 +90,7 @@ func (e *Engine) execDispatcher(grafanaCtx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Engine) executeJob(grafanaCtx context.Context, job *Job) {
|
||||
func (e *Engine) executeJob(grafanaCtx context.Context, job *Job) error {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
e.log.Error("Execute Alert Panic", "error", err, "stack", log.Stack(1))
|
||||
@@ -108,11 +108,14 @@ func (e *Engine) executeJob(grafanaCtx context.Context, job *Job) {
|
||||
}()
|
||||
|
||||
select {
|
||||
|
||||
case <-grafanaCtx.Done():
|
||||
return grafanaCtx.Err()
|
||||
case evalContext := <-done:
|
||||
e.resultQueue <- evalContext
|
||||
case <-grafanaCtx.Done():
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *Engine) resultDispatcher(grafanaCtx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user