From 70beda092a47c161b0483eb93c97547acbbdf63b Mon Sep 17 00:00:00 2001 From: machine424 Date: Mon, 10 Jun 2024 21:26:36 +0200 Subject: [PATCH] fix(notifier): take alertmanagerSet.mtx before checking alertmanagerSet.ams in sendAll Signed-off-by: machine424 --- notifier/notifier.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notifier/notifier.go b/notifier/notifier.go index a375a0749..eb83c45b0 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -475,10 +475,6 @@ func (n *Manager) sendAll(alerts ...*Alert) bool { numSuccess atomic.Uint64 ) for _, ams := range amSets { - if len(ams.ams) == 0 { - continue - } - var ( payload []byte err error @@ -487,6 +483,10 @@ func (n *Manager) sendAll(alerts ...*Alert) bool { ams.mtx.RLock() + if len(ams.ams) == 0 { + ams.mtx.RUnlock() + continue + } if len(ams.cfg.AlertRelabelConfigs) > 0 { amAlerts = relabelAlerts(ams.cfg.AlertRelabelConfigs, labels.Labels{}, alerts)