Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Respect default Resque Wildcard #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/resque/plugins/dynamic_queues/queues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
5 changes: 5 additions & 0 deletions spec/queues_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down