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)
222222 #
223223 # If no queue can be inferred this method will raise a `Resque::NoQueueError`
224224 #
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
226226 # before_enqueue hook.
227227 #
228228 # This method is considered part of the `stable` API.
229229 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 )
230243 # Perform before_enqueue hooks. Don't perform enqueue if any hook returns false
231244 before_hooks = Plugin . before_enqueue_hooks ( klass ) . collect do |hook |
232245 klass . send ( hook , *args )
233246 end
234247 return nil if before_hooks . any? { |result | result == false }
235248
236- Job . create ( queue_from_class ( klass ) , klass , *args )
249+ Job . create ( queue , klass , *args )
237250
238251 Plugin . after_enqueue_hooks ( klass ) . each do |hook |
239252 klass . send ( hook , *args )
You can’t perform that action at this time.
0 commit comments