Skip to content

Commit 611ddc1

Browse files
committed
Fix misusage of RLock in timeCache lru.Cache.Get()
1 parent 66334f0 commit 611ddc1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/kubelet/time_cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727

2828
// timeCache stores a time keyed by uid
2929
type timeCache struct {
30-
lock sync.RWMutex
30+
lock sync.Mutex
3131
cache *lru.Cache
3232
}
3333

@@ -53,8 +53,8 @@ func (c *timeCache) Remove(uid types.UID) {
5353
}
5454

5555
func (c *timeCache) Get(uid types.UID) (time.Time, bool) {
56-
c.lock.RLock()
57-
defer c.lock.RUnlock()
56+
c.lock.Lock()
57+
defer c.lock.Unlock()
5858
value, ok := c.cache.Get(uid)
5959
if !ok {
6060
return time.Time{}, false

0 commit comments

Comments
 (0)