Skip to content

Commit 7027d71

Browse files
mrduncandefunkt
authored andcommitted
Strip whitespace from queue names
1 parent fd03267 commit 7027d71

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/resque/worker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def self.exists?(worker_id)
7373
# in alphabetical order. Queues can be dynamically added or
7474
# removed without needing to restart workers using this method.
7575
def initialize(*queues)
76-
@queues = queues
76+
@queues = queues.map { |queue| queue.to_s.strip }
7777
validate_queues
7878
end
7979

test/worker_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
assert_equal 2, Resque::Failure.count
5858
end
5959

60+
test "strips whitespace from queue names" do
61+
queues = "critical, high, low".split(',')
62+
worker = Resque::Worker.new(*queues)
63+
assert_equal %w( critical high low ), worker.queues
64+
end
65+
6066
test "can work on multiple queues" do
6167
Resque::Job.create(:high, GoodJob)
6268
Resque::Job.create(:critical, GoodJob)

0 commit comments

Comments
 (0)