mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #4724 from mikedanese/readiness-states-cleanup
Don't lock readinessStates on concurrent reads
This commit is contained in:
commit
b261d8c60a
@ -162,7 +162,8 @@ func newReadinessStates() *readinessStates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type readinessStates struct {
|
type readinessStates struct {
|
||||||
sync.Mutex
|
// guards states
|
||||||
|
sync.RWMutex
|
||||||
states map[string]bool
|
states map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,8 +175,8 @@ func (r *readinessStates) IsReady(c api.ContainerStatus) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *readinessStates) get(key string) bool {
|
func (r *readinessStates) get(key string) bool {
|
||||||
r.Lock()
|
r.RLock()
|
||||||
defer r.Unlock()
|
defer r.RUnlock()
|
||||||
state, found := r.states[key]
|
state, found := r.states[key]
|
||||||
return state && found
|
return state && found
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user