From f76510d99e79f83f27de0fd802eec0f84e932e0f Mon Sep 17 00:00:00 2001 From: KeZhang Date: Fri, 3 Jun 2016 16:33:36 +0800 Subject: [PATCH] Update reason_cache.go --- pkg/kubelet/reason_cache.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/reason_cache.go b/pkg/kubelet/reason_cache.go index 6134ffe1b07..2374f159e05 100644 --- a/pkg/kubelet/reason_cache.go +++ b/pkg/kubelet/reason_cache.go @@ -36,7 +36,7 @@ import ( // TODO(random-liu): Use more reliable cache which could collect garbage of failed pod. // TODO(random-liu): Move reason cache to somewhere better. type ReasonCache struct { - lock sync.RWMutex + lock sync.Mutex cache *lru.Cache } @@ -93,8 +93,8 @@ func (c *ReasonCache) Remove(uid types.UID, name string) { // whether an error reason is found in the cache. If no error reason is found, empty string will // be returned for error reason and error message. func (c *ReasonCache) Get(uid types.UID, name string) (error, string, bool) { - c.lock.RLock() - defer c.lock.RUnlock() + c.lock.Lock() + defer c.lock.Unlock() value, ok := c.cache.Get(c.composeKey(uid, name)) if !ok { return nil, "", ok