Commit c0829903 by bergquist

fix(alerting): scope variable was updated

closes #6228
parent b8b577ea
...@@ -68,8 +68,9 @@ func (n *RootNotifier) sendNotifications(context *EvalContext, notifiers []Notif ...@@ -68,8 +68,9 @@ func (n *RootNotifier) sendNotifications(context *EvalContext, notifiers []Notif
g, _ := errgroup.WithContext(context.Ctx) g, _ := errgroup.WithContext(context.Ctx)
for _, notifier := range notifiers { for _, notifier := range notifiers {
n.log.Info("Sending notification", "type", notifier.GetType(), "id", notifier.GetNotifierId(), "isDefault", notifier.GetIsDefault()) not := notifier //avoid updating scope variable in go routine
g.Go(func() error { return notifier.Notify(context) }) n.log.Info("Sending notification", "type", not.GetType(), "id", not.GetNotifierId(), "isDefault", not.GetIsDefault())
g.Go(func() error { return not.Notify(context) })
} }
return g.Wait() return g.Wait()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment