mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Fix misusage of RLock in timeCache lru.Cache.Get()
This commit is contained in:
		@@ -27,7 +27,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// timeCache stores a time keyed by uid
 | 
					// timeCache stores a time keyed by uid
 | 
				
			||||||
type timeCache struct {
 | 
					type timeCache struct {
 | 
				
			||||||
	lock  sync.RWMutex
 | 
						lock  sync.Mutex
 | 
				
			||||||
	cache *lru.Cache
 | 
						cache *lru.Cache
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,8 +53,8 @@ func (c *timeCache) Remove(uid types.UID) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (c *timeCache) Get(uid types.UID) (time.Time, bool) {
 | 
					func (c *timeCache) Get(uid types.UID) (time.Time, bool) {
 | 
				
			||||||
	c.lock.RLock()
 | 
						c.lock.Lock()
 | 
				
			||||||
	defer c.lock.RUnlock()
 | 
						defer c.lock.Unlock()
 | 
				
			||||||
	value, ok := c.cache.Get(uid)
 | 
						value, ok := c.cache.Get(uid)
 | 
				
			||||||
	if !ok {
 | 
						if !ok {
 | 
				
			||||||
		return time.Time{}, false
 | 
							return time.Time{}, false
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user