plugin/pkg/cache: fix data race (#4932)
This commit is contained in:
parent
2a3f7c93d6
commit
4a7565ff63
1 changed files with 1 additions and 1 deletions
2
plugin/pkg/cache/cache.go
vendored
2
plugin/pkg/cache/cache.go
vendored
|
@ -136,8 +136,8 @@ func (s *shard) Len() int {
|
||||||
|
|
||||||
// Walk walks the shard for each element the function f is executed while holding a write lock.
|
// Walk walks the shard for each element the function f is executed while holding a write lock.
|
||||||
func (s *shard) Walk(f func(map[uint64]interface{}, uint64) bool) {
|
func (s *shard) Walk(f func(map[uint64]interface{}, uint64) bool) {
|
||||||
items := make([]uint64, len(s.items))
|
|
||||||
s.RLock()
|
s.RLock()
|
||||||
|
items := make([]uint64, len(s.items))
|
||||||
i := 0
|
i := 0
|
||||||
for k := range s.items {
|
for k := range s.items {
|
||||||
items[i] = k
|
items[i] = k
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue