mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 00:34:10 -04:00
Update lookup_cache.go
MatchingCache struct hold a RWLock, so Get operation of Cache should use RLock properly, nor WLock
This commit is contained in:
parent
1cba05574b
commit
49f4f242a8
1 changed files with 2 additions and 2 deletions
|
|
@ -72,8 +72,8 @@ func (c *MatchingCache) Add(labelObj objectWithMeta, selectorObj objectWithMeta)
|
|||
// we need check in the external request to ensure the cache data is not dirty.
|
||||
func (c *MatchingCache) GetMatchingObject(labelObj objectWithMeta) (controller interface{}, exists bool) {
|
||||
key := keyFunc(labelObj)
|
||||
c.mutex.Lock()
|
||||
defer c.mutex.Unlock()
|
||||
c.mutex.RLock()
|
||||
defer c.mutex.RUnlock()
|
||||
return c.cache.Get(key)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue