From a72d3185c1c1ffbf7889a930725ceb5baf3434c7 Mon Sep 17 00:00:00 2001 From: Ryan LeCompte Date: Tue, 3 Apr 2012 20:38:03 -0700 Subject: [PATCH] initialize queue names only once --- lib/sidekiq/fetch.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/sidekiq/fetch.rb b/lib/sidekiq/fetch.rb index 281336c3..acd864d7 100644 --- a/lib/sidekiq/fetch.rb +++ b/lib/sidekiq/fetch.rb @@ -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