Commit 4a7565ff authored by Wu Shuang's avatar Wu Shuang Committed by GitHub

plugin/pkg/cache: fix data race (#4932)

parent 2a3f7c93
...@@ -136,8 +136,8 @@ func (s *shard) Len() int { ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment