mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 00:34:10 -04:00
Merge pull request #94774 from sensesai/senses/fixLruCache-1.19
Fix misusage of RLock in timeCache lru.Cache.Get() for release-1.19
This commit is contained in:
commit
30a3ef1ce0
1 changed files with 3 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
// timeCache stores a time keyed by uid
|
||||
type timeCache struct {
|
||||
lock sync.RWMutex
|
||||
lock sync.Mutex
|
||||
cache *lru.Cache
|
||||
}
|
||||
|
||||
|
|
@ -53,8 +53,8 @@ func (c *timeCache) Remove(uid types.UID) {
|
|||
}
|
||||
|
||||
func (c *timeCache) Get(uid types.UID) (time.Time, bool) {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
value, ok := c.cache.Get(uid)
|
||||
if !ok {
|
||||
return time.Time{}, false
|
||||
|
|
|
|||
Loading…
Reference in a new issue