From 2c84cd6448f2187c953578e6a286857c18842e30 Mon Sep 17 00:00:00 2001 From: Eugene Bujak Date: Mon, 8 Oct 2018 14:18:19 +0300 Subject: [PATCH] coredns plugin -- Fix deadlock during coredns reload --- coredns_plugin/querylog_top.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coredns_plugin/querylog_top.go b/coredns_plugin/querylog_top.go index bcc12b3a..70ec0034 100644 --- a/coredns_plugin/querylog_top.go +++ b/coredns_plugin/querylog_top.go @@ -210,10 +210,10 @@ func (r *dayTop) addEntry(entry *logEntry, now time.Time) error { func loadTopFromFiles() error { now := time.Now() runningTop.RLock() + defer runningTop.RUnlock() if runningTop.loaded { return nil } - defer runningTop.RUnlock() onEntry := func(entry *logEntry) error { err := runningTop.addEntry(entry, now) if err != nil {