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)
|
def initialize(mgr, queues)
|
||||||
@mgr = mgr
|
@mgr = mgr
|
||||||
@queues = queues
|
@queues = queues.map { |q| "queue:#{q}" }
|
||||||
@num_queues = queues.uniq.size
|
@num_queues = queues.uniq.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,8 +49,7 @@ module Sidekiq
|
||||||
# recreate the queue command each time we invoke Redis#blpop
|
# recreate the queue command each time we invoke Redis#blpop
|
||||||
# to honor weights and avoid queue starvation.
|
# to honor weights and avoid queue starvation.
|
||||||
def queues_cmd
|
def queues_cmd
|
||||||
queues = @queues.sample(@num_queues)
|
cmd = @queues.sample(@num_queues)
|
||||||
cmd = queues.map { |q| "queue:#{q}" }
|
|
||||||
cmd << TIMEOUT
|
cmd << TIMEOUT
|
||||||
cmd
|
cmd
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue