Skip to content
This repository has been archived by the owner on Apr 3, 2021. It is now read-only.

Commit

Permalink
fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
eycorsican committed May 14, 2019
1 parent e7e290f commit 7391db8
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions common/dns/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ func cacheKey(q dns.Question) string {
func (c *simpleDnsCache) cleanup() {
newStorage := make(map[string]*dnsCacheEntry)
log.Debugf("cleaning up dns %v cache entries", len(c.storage))
c.mutex.Lock()
for key, entry := range c.storage {
if time.Now().Before(entry.exp) {
newStorage[key] = entry
}
}
c.storage = newStorage
c.mutex.Unlock()
log.Debugf("cleanup done, remaining %v entries", len(c.storage))
}

Expand Down

0 comments on commit 7391db8

Please sign in to comment.