mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Make threadSafeMap.ListIndexFuncValues thread safe.
Surprisingly, this method does not lock and I get data race reports in my persistent volume unit tests (which use this map).
This commit is contained in:
parent
963aebd3e5
commit
42d940735b
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 {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
|
||||
index := c.indices[indexName]
|
||||
names := make([]string, 0, len(index))
|
||||
for key := range index {
|
||||
|
Loading…
Reference in New Issue
Block a user