1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Simplify BasicFetch#queues_cmd

And improve weight honoring.
This commit is contained in:
Ravil Bayramgalin 2013-01-11 09:59:11 +04:00
parent 5804ad67d3
commit 8783c4ac1d

View file

@ -93,9 +93,7 @@ module Sidekiq
# recreate the queue command each time we invoke Redis#blpop
# to honor weights and avoid queue starvation.
def queues_cmd
return @unique_queues.dup << Sidekiq::Fetcher::TIMEOUT if @strictly_ordered_queues
queues = @queues.sample(@unique_queues.size).uniq
queues.concat(@unique_queues - queues)
queues = @strictly_ordered_queues ? @unique_queues.dup : @queues.shuffle.uniq
queues << Sidekiq::Fetcher::TIMEOUT
end
end