File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -222,18 +222,31 @@ def watch_queue(queue)
222
222
#
223
223
# If no queue can be inferred this method will raise a `Resque::NoQueueError`
224
224
#
225
- # Returns true if the job was queued, nil if the job was rejected by a
225
+ # Returns true if the job was queued, nil if the job was rejected by a
226
226
# before_enqueue hook.
227
227
#
228
228
# This method is considered part of the `stable` API.
229
229
def enqueue ( klass , *args )
230
+ enqueue_to ( queue_from_class ( klass ) , klass , *args )
231
+ end
232
+
233
+ # Just like `enqueue` but allows you to specify the queue you want to
234
+ # use. Runs hooks.
235
+ #
236
+ # `queue` should be the String name of the queue you're targeting.
237
+ #
238
+ # Returns true if the job was queued, nil if the job was rejected by a
239
+ # before_enqueue hook.
240
+ #
241
+ # This method is considered part of the `stable` API.
242
+ def enqueue_to ( queue , klass , *args )
230
243
# Perform before_enqueue hooks. Don't perform enqueue if any hook returns false
231
244
before_hooks = Plugin . before_enqueue_hooks ( klass ) . collect do |hook |
232
245
klass . send ( hook , *args )
233
246
end
234
247
return nil if before_hooks . any? { |result | result == false }
235
248
236
- Job . create ( queue_from_class ( klass ) , klass , *args )
249
+ Job . create ( queue , klass , *args )
237
250
238
251
Plugin . after_enqueue_hooks ( klass ) . each do |hook |
239
252
klass . send ( hook , *args )
You can’t perform that action at this time.
0 commit comments