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)
223
223
224
224
# Returns a list of queues to use when searching for a job.
225
225
# 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.
227
229
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
229
231
end
230
232
231
233
# 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
179
179
assert_equal 0 , Resque . size ( :beer )
180
180
end
181
181
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
+
182
191
it "processes * queues in alphabetical order" do
183
192
Resque ::Job . create ( :high , GoodJob )
184
193
Resque ::Job . create ( :critical , GoodJob )
You can’t perform that action at this time.
0 commit comments