mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
initialize queue names only once
This commit is contained in:
parent
c66d58a235
commit
a72d3185c1
1 changed files with 2 additions and 3 deletions
|
@ -15,7 +15,7 @@ module Sidekiq
|
|||
|
||||
def initialize(mgr, queues)
|
||||
@mgr = mgr
|
||||
@queues = queues
|
||||
@queues = queues.map { |q| "queue:#{q}" }
|
||||
@num_queues = queues.uniq.size
|
||||
end
|
||||
|
||||
|
@ -49,8 +49,7 @@ module Sidekiq
|
|||
# recreate the queue command each time we invoke Redis#blpop
|
||||
# to honor weights and avoid queue starvation.
|
||||
def queues_cmd
|
||||
queues = @queues.sample(@num_queues)
|
||||
cmd = queues.map { |q| "queue:#{q}" }
|
||||
cmd = @queues.sample(@num_queues)
|
||||
cmd << TIMEOUT
|
||||
cmd
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue