File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -223,9 +223,11 @@ def reserve(interval = 5.0)
223223
224224 # Returns a list of queues to use when searching for a job.
225225 # A splat ("*") means you want every queue (in alpha order) - this
226- # can be useful for dynamically adding new queues.
226+ # can be useful for dynamically adding new queues. Low priority queues
227+ # can be placed after a splat to ensure execution after all other dynamic
228+ # queues.
227229 def queues
228- @queues . map { |queue | queue == "*" ? Resque . queues . sort : queue } . flatten . uniq
230+ @queues . map { |queue | queue == "*" ? ( Resque . queues - @queues ) . sort : queue } . flatten . uniq
229231 end
230232
231233 # Not every platform supports fork. Here we do our magic to
Original file line number Diff line number Diff line change @@ -179,6 +179,15 @@ def self.perform
179179 assert_equal 0 , Resque . size ( :beer )
180180 end
181181
182+ it "preserves order with a wildcard in the middle of a list" do
183+ Resque ::Job . create ( :critical , GoodJob )
184+ Resque ::Job . create ( :bulk , GoodJob )
185+
186+ worker = Resque ::Worker . new ( :beer , "*" , :bulk )
187+
188+ assert_equal %w( beer critical jobs bulk ) , worker . queues
189+ end
190+
182191 it "processes * queues in alphabetical order" do
183192 Resque ::Job . create ( :high , GoodJob )
184193 Resque ::Job . create ( :critical , GoodJob )
You can’t perform that action at this time.
0 commit comments