diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb index f55db5a588a837e01a42ddb449f8d37d00700260..68d46e646600bc8003a2f04eaa185ed8d2721a7e 100644 --- a/activejob/lib/active_job/core.rb +++ b/activejob/lib/active_job/core.rb @@ -48,8 +48,8 @@ def set(options={}) end end - # Creates a new job instance. Takes as arguments the arguments that - # will be passed to the perform method. + # Creates a new job instance. Takes the arguments that will be + # passed to the perform method. def initialize(*arguments) @arguments = arguments @job_id = SecureRandom.uuid @@ -84,6 +84,3 @@ def deserialize_arguments(serialized_args) end end end - - - diff --git a/activejob/lib/active_job/enqueuing.rb b/activejob/lib/active_job/enqueuing.rb index cca0a2a8d68580e1f1fdd08800fc391c54582ca7..53d944021a4b15050fc34d67c3c4b9e15ca1b491 100644 --- a/activejob/lib/active_job/enqueuing.rb +++ b/activejob/lib/active_job/enqueuing.rb @@ -22,7 +22,7 @@ def job_or_instantiate(*args) end end - # Reschedule the job to be re-executed. This is useful in combination + # Reschedules the job to be re-executed. This is useful in combination # with the +rescue_from+ option. When you rescue an exception from your job # you can ask Active Job to retry performing your job. # @@ -37,6 +37,7 @@ def job_or_instantiate(*args) # rescue_from(ErrorLoadingSite) do # retry_job queue: :low_priority # end + # # def perform(*args) # # raise ErrorLoadingSite if cannot scrape # end diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 875919e23777c14fb97b59c2ccc0900e280b3429..de69ab3211bdc8100703ab523141ece546c9e740 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -172,15 +172,15 @@ end # environment ``` -If you want more control on what queue a job will be run you can pass a :queue -option to #set: +If you want more control on what queue a job will be run you can pass a `:queue` +option to `#set`: ```ruby MyJob.set(queue: :another_queue).perform_later(record) ``` -To control the queue from the job level you can pass a block to queue_as. The -block will be executed in the job context (so you can access self.arguments) +To control the queue from the job level you can pass a block to `#queue_as`. The +block will be executed in the job context (so you can access `self.arguments`) and you must return the queue name: ```ruby @@ -202,7 +202,6 @@ end ProcessVideoJob.perform_later(Video.last) ``` - NOTE: Make sure your queueing backend "listens" on your queue name. For some backends you need to specify the queues to listen to.