coredns plugin -- change rlock to lock when loading top stats to avoid doing it in parallel

This commit is contained in:
Eugene Bujak 2018-10-08 17:14:11 +03:00
parent 2c84cd6448
commit 3109529dbb
1 changed files with 2 additions and 2 deletions

View File

@ -209,8 +209,8 @@ func (r *dayTop) addEntry(entry *logEntry, now time.Time) error {
func loadTopFromFiles() error {
now := time.Now()
runningTop.RLock()
defer runningTop.RUnlock()
runningTop.Lock() // not rlock because we set it at the end of the function
defer runningTop.Unlock()
if runningTop.loaded {
return nil
}