From 2935ff84e765d8837483674662a27740e8765d12 Mon Sep 17 00:00:00 2001 From: Carl Henrik Lunde Date: Sat, 8 Oct 2016 22:07:29 +0200 Subject: [PATCH] inhibitrule: defer Unlock to fix race --- inhibit/inhibit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inhibit/inhibit.go b/inhibit/inhibit.go index 0f5a936c..fe50a0f6 100644 --- a/inhibit/inhibit.go +++ b/inhibit/inhibit.go @@ -184,7 +184,7 @@ func NewInhibitRule(cr *config.InhibitRule) *InhibitRule { // set the alert in the source cache. func (r *InhibitRule) set(a *types.Alert) { r.mtx.Lock() - r.mtx.Unlock() + defer r.mtx.Unlock() r.scache[a.Fingerprint()] = a }