coredns plugin -- Fix deadlock during coredns reload

This commit is contained in:
Eugene Bujak 2018-10-08 14:18:19 +03:00
parent 0440ef016a
commit 2c84cd6448
1 changed files with 1 additions and 1 deletions

View File

@ -210,10 +210,10 @@ func (r *dayTop) addEntry(entry *logEntry, now time.Time) error {
func loadTopFromFiles() error { func loadTopFromFiles() error {
now := time.Now() now := time.Now()
runningTop.RLock() runningTop.RLock()
defer runningTop.RUnlock()
if runningTop.loaded { if runningTop.loaded {
return nil return nil
} }
defer runningTop.RUnlock()
onEntry := func(entry *logEntry) error { onEntry := func(entry *logEntry) error {
err := runningTop.addEntry(entry, now) err := runningTop.addEntry(entry, now)
if err != nil { if err != nil {