From cfc32cbd1cee4ae9bd6903906694670e3de2d3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Sun, 14 Jun 2020 20:30:19 +0200 Subject: [PATCH] fixed race condition when deleting a rule --- daemon/rule/loader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/rule/loader.go b/daemon/rule/loader.go index cb9b4a3823..fec87b81a0 100644 --- a/daemon/rule/loader.go +++ b/daemon/rule/loader.go @@ -47,8 +47,8 @@ func NewLoader(liveReload bool) (*Loader, error) { // NumRules returns he number of loaded rules. func (l *Loader) NumRules() int { - l.RLock() - defer l.RUnlock() + l.Lock() + defer l.Unlock() return len(l.rules) }