diff --git a/lib/resque/plugins/dynamic_queues/queues.rb b/lib/resque/plugins/dynamic_queues/queues.rb index 6fc7aa9..40d99b0 100644 --- a/lib/resque/plugins/dynamic_queues/queues.rb +++ b/lib/resque/plugins/dynamic_queues/queues.rb @@ -19,7 +19,10 @@ module Queues def queues_with_dynamic queue_names = @queues.dup - return queues_without_dynamic if queue_names.grep(/(^!)|(^@)|(\*)/).size == 0 + # Make sure it's a pattern wildcard and not a general wildcard. + dynamic_pattern = /(^!)|(^@)|((^\*[a-zA-Z0-9_-]+)|([^\*][a-zA-Z0-9_-]+\*))/ + + return queues_without_dynamic if queue_names.grep(dynamic_pattern).size == 0 real_queues = Resque.queues matched_queues = [] diff --git a/spec/queues_spec.rb b/spec/queues_spec.rb index 47161f8..e836550 100644 --- a/spec/queues_spec.rb +++ b/spec/queues_spec.rb @@ -124,6 +124,11 @@ worker.queues.should == ["high_x", "high_y", "superhigh_z"] end + it "can order queues with traditional wildcard use" do + worker = Resque::Worker.new("high_x", "high_y", "*", "superhigh_z") + worker.queues.should == ["high_x", "high_y", "foo", "superhigh_z"] + end + it "can blacklist queues" do worker = Resque::Worker.new("*", "!foo") worker.queues.should == ["high_x", "high_y", "superhigh_z"]