Skip to content

Commit

Permalink
bugfix: Correct parsing of QUEUES argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandotsmith committed Jan 7, 2014
1 parent 853d022 commit f7e2197
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/queue_classic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module QC
# notes the queue. You can point your workers
# at different queues but only one at a time.
QUEUE = ENV["QUEUE"] || "default"
QUEUES = ENV["QUEUES"] || []
QUEUES = (ENV["QUEUES"] && ENV["QUEUES"].split(",")) || []

# Set this to 1 for strict FIFO.
# There is nothing special about 9....
Expand Down
10 changes: 5 additions & 5 deletions lib/queue_classic/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def initialize(args={})
@wait_interval = args[:wait_interval] || QC::WAIT_TIME
@conn_adapter = ConnAdapter.new(args[:connection])
@queues = setup_queues(@conn_adapter,
args[:q_name], args[:q_names], args[:top_bound])
(args[:q_name] || QC::QUEUE),
(args[:q_names] || QC::QUEUES),
(args[:top_bound] || QC::TOP_BOUND))
log(args.merge(:at => "worker_initialized"))
@running = true
end
Expand Down Expand Up @@ -131,10 +133,8 @@ def log(data)

private

def setup_queues(adapter, q_name, q_names, top_bound)
name = q_name || QC::QUEUE
names = q_names || QC::QUEUES
names << name unless names.include?(name)
def setup_queues(adapter, queue, queues, top_bound)
names = queues.length > 0 ? queues : [queue]
names.map do |name|
QC::Queue.new(name, top_bound).tap do |q|
q.conn_adapter = adapter
Expand Down

0 comments on commit f7e2197

Please sign in to comment.