mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Merge pull request #25141 from jsafrane/devel/fix-store-race
Make threadSafeMap.ListIndexFuncValues thread safe.
This commit is contained in:
commit
64e1240180
3
pkg/client/cache/thread_safe_store.go
vendored
3
pkg/client/cache/thread_safe_store.go
vendored
@ -179,6 +179,9 @@ func (c *threadSafeMap) ByIndex(indexName, indexKey string) ([]interface{}, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *threadSafeMap) ListIndexFuncValues(indexName string) []string {
|
func (c *threadSafeMap) ListIndexFuncValues(indexName string) []string {
|
||||||
|
c.lock.RLock()
|
||||||
|
defer c.lock.RUnlock()
|
||||||
|
|
||||||
index := c.indices[indexName]
|
index := c.indices[indexName]
|
||||||
names := make([]string, 0, len(index))
|
names := make([]string, 0, len(index))
|
||||||
for key := range index {
|
for key := range index {
|
||||||
|
Loading…
Reference in New Issue
Block a user