cache/namedmemcache: Fix data race

This commit is contained in:
Bjørn Erik Pedersen 2018-12-27 12:05:42 +01:00
parent cc351958e1
commit 3f3187de0f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -68,11 +68,6 @@ func (c *Cache) GetOrCreate(key string, create func() (interface{}, error)) (int
c.nlocker.Lock(key)
defer c.nlocker.Unlock(key)
// Double check
if entry, found := c.cache[key]; found {
return entry.value, entry.err
}
// Create it.
value, err := create()