提交 aeb431a6 编写于 作者: R Robin Dupret

Tiny documentation improvements [ci skip]

上级 c1a118ab
...@@ -48,8 +48,8 @@ def set(options={}) ...@@ -48,8 +48,8 @@ def set(options={})
end end
end end
# Creates a new job instance. Takes as arguments the arguments that # Creates a new job instance. Takes the arguments that will be
# will be passed to the perform method. # passed to the perform method.
def initialize(*arguments) def initialize(*arguments)
@arguments = arguments @arguments = arguments
@job_id = SecureRandom.uuid @job_id = SecureRandom.uuid
...@@ -84,6 +84,3 @@ def deserialize_arguments(serialized_args) ...@@ -84,6 +84,3 @@ def deserialize_arguments(serialized_args)
end end
end end
end end
...@@ -22,7 +22,7 @@ def job_or_instantiate(*args) ...@@ -22,7 +22,7 @@ def job_or_instantiate(*args)
end end
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 # with the +rescue_from+ option. When you rescue an exception from your job
# you can ask Active Job to retry performing your job. # you can ask Active Job to retry performing your job.
# #
...@@ -37,6 +37,7 @@ def job_or_instantiate(*args) ...@@ -37,6 +37,7 @@ def job_or_instantiate(*args)
# rescue_from(ErrorLoadingSite) do # rescue_from(ErrorLoadingSite) do
# retry_job queue: :low_priority # retry_job queue: :low_priority
# end # end
#
# def perform(*args) # def perform(*args)
# # raise ErrorLoadingSite if cannot scrape # # raise ErrorLoadingSite if cannot scrape
# end # end
......
...@@ -172,15 +172,15 @@ end ...@@ -172,15 +172,15 @@ end
# environment # environment
``` ```
If you want more control on what queue a job will be run you can pass a :queue If you want more control on what queue a job will be run you can pass a `:queue`
option to #set: option to `#set`:
```ruby ```ruby
MyJob.set(queue: :another_queue).perform_later(record) 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 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) block will be executed in the job context (so you can access `self.arguments`)
and you must return the queue name: and you must return the queue name:
```ruby ```ruby
...@@ -202,7 +202,6 @@ end ...@@ -202,7 +202,6 @@ end
ProcessVideoJob.perform_later(Video.last) ProcessVideoJob.perform_later(Video.last)
``` ```
NOTE: Make sure your queueing backend "listens" on your queue name. For some NOTE: Make sure your queueing backend "listens" on your queue name. For some
backends you need to specify the queues to listen to. backends you need to specify the queues to listen to.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册