Skip to content

Commit

Permalink
refactor queueset locks #2
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Scherba <mikhail.scherba@flant.com>
  • Loading branch information
miklezzzz committed Feb 17, 2025
1 parent 10fa483 commit 1c74525
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/task/queue/queue_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func (tqs *TaskQueueSet) Iterate(doFn func(queue *TaskQueue)) {
return
}

tqs.m.RLock()
defer tqs.m.RUnlock()
if len(tqs.Queues) == 0 {
return
}
Expand All @@ -126,14 +128,11 @@ func (tqs *TaskQueueSet) Iterate(doFn func(queue *TaskQueue)) {
}
// TODO sort names

tqs.m.RLock()
for _, q := range tqs.Queues {
if q.Name != tqs.MainName {
doFn(q)
}
}

tqs.m.RUnlock()
}

func (tqs *TaskQueueSet) Remove(name string) {
Expand Down

0 comments on commit 1c74525

Please sign in to comment.