mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
notifier: forget unlock before return (#7133)
Signed-off-by: BurtonQin <bobbqqin@gmail.com> Co-authored-by: root <root@neon-cats-4.localdomain>
This commit is contained in:
parent
5c5ac7cc3e
commit
f3c6d26781
|
@ -483,6 +483,7 @@ func (n *Manager) sendAll(alerts ...*Alert) bool {
|
||||||
v1Payload, err = json.Marshal(alerts)
|
v1Payload, err = json.Marshal(alerts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(n.logger).Log("msg", "Encoding alerts for Alertmanager API v1 failed", "err", err)
|
level.Error(n.logger).Log("msg", "Encoding alerts for Alertmanager API v1 failed", "err", err)
|
||||||
|
ams.mtx.RUnlock()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,6 +498,7 @@ func (n *Manager) sendAll(alerts ...*Alert) bool {
|
||||||
v2Payload, err = json.Marshal(openAPIAlerts)
|
v2Payload, err = json.Marshal(openAPIAlerts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(n.logger).Log("msg", "Encoding alerts for Alertmanager API v2 failed", "err", err)
|
level.Error(n.logger).Log("msg", "Encoding alerts for Alertmanager API v2 failed", "err", err)
|
||||||
|
ams.mtx.RUnlock()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,6 +511,7 @@ func (n *Manager) sendAll(alerts ...*Alert) bool {
|
||||||
"msg", fmt.Sprintf("Invalid Alertmanager API version '%v', expected one of '%v'", ams.cfg.APIVersion, config.SupportedAlertmanagerAPIVersions),
|
"msg", fmt.Sprintf("Invalid Alertmanager API version '%v', expected one of '%v'", ams.cfg.APIVersion, config.SupportedAlertmanagerAPIVersions),
|
||||||
"err", err,
|
"err", err,
|
||||||
)
|
)
|
||||||
|
ams.mtx.RUnlock()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue