Skip to content

Commit c082990

Browse files
committed
fix(alerting): scope variable was updated
closes grafana#6228
1 parent b8b577e commit c082990

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/services/alerting/notifier.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ func (n *RootNotifier) sendNotifications(context *EvalContext, notifiers []Notif
6868
g, _ := errgroup.WithContext(context.Ctx)
6969

7070
for _, notifier := range notifiers {
71-
n.log.Info("Sending notification", "type", notifier.GetType(), "id", notifier.GetNotifierId(), "isDefault", notifier.GetIsDefault())
72-
g.Go(func() error { return notifier.Notify(context) })
71+
not := notifier //avoid updating scope variable in go routine
72+
n.log.Info("Sending notification", "type", not.GetType(), "id", not.GetNotifierId(), "isDefault", not.GetIsDefault())
73+
g.Go(func() error { return not.Notify(context) })
7374
}
7475

7576
return g.Wait()

0 commit comments

Comments
 (0)