Skip to content

Commit 1c74525

Browse files
committed
refactor queueset locks #2
Signed-off-by: Mikhail Scherba <[email protected]>
1 parent 10fa483 commit 1c74525

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/task/queue/queue_set.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ func (tqs *TaskQueueSet) Iterate(doFn func(queue *TaskQueue)) {
116116
return
117117
}
118118

119+
tqs.m.RLock()
120+
defer tqs.m.RUnlock()
119121
if len(tqs.Queues) == 0 {
120122
return
121123
}
@@ -126,14 +128,11 @@ func (tqs *TaskQueueSet) Iterate(doFn func(queue *TaskQueue)) {
126128
}
127129
// TODO sort names
128130

129-
tqs.m.RLock()
130131
for _, q := range tqs.Queues {
131132
if q.Name != tqs.MainName {
132133
doFn(q)
133134
}
134135
}
135-
136-
tqs.m.RUnlock()
137136
}
138137

139138
func (tqs *TaskQueueSet) Remove(name string) {

0 commit comments

Comments
 (0)