Skip to content

Commit

Permalink
fix: concurrent map iteration and map write
Browse files Browse the repository at this point in the history
  • Loading branch information
luckymrwang committed Jul 7, 2023
1 parent 0610339 commit 8fa412a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func (r *Memory) Current() (*Counts, error) {
r.mut.RLock()
defer r.mut.RUnlock()
cts := NewCounts()
cts.Counts = r.countMap
for key, val := range r.countMap {
cts.Counts[key] = val
}
return cts, nil
}

0 comments on commit 8fa412a

Please sign in to comment.