From d6fb8ce05acce3bedf0b59995bf666ee78febe96 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Sun, 22 Feb 2015 14:35:53 -0800 Subject: [PATCH] Don't lock readinessStates on concurrent reads. --- pkg/kubelet/probe.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/probe.go b/pkg/kubelet/probe.go index 382b6f4da45..75cab23604a 100644 --- a/pkg/kubelet/probe.go +++ b/pkg/kubelet/probe.go @@ -162,7 +162,8 @@ func newReadinessStates() *readinessStates { } type readinessStates struct { - sync.Mutex + // guards states + sync.RWMutex states map[string]bool } @@ -174,8 +175,8 @@ func (r *readinessStates) IsReady(c api.ContainerStatus) bool { } func (r *readinessStates) get(key string) bool { - r.Lock() - defer r.Unlock() + r.RLock() + defer r.RUnlock() state, found := r.states[key] return state && found }