I am using the delayed_job gem like this:
Delayed开发者_JS百科::Job.enqueue Note.new(parameter_hash)
The jobs are processed by Heroku workers. I need to prioritize some jobs. I know there is a priority setting for delayed_job, but I'm not sure how to use it with the above job creation line.
How do I make a job higher priority?
According to the docs, by default jobs are scheduled with a priority of 0--which is the highest priority. In this case, lower numbers have higher priorities.
To schedule some jobs at different priorities, use:
Delayed::Job.enqueue Note.new(parameter_hash), :priority => 10
Again, though, lower number = higher priority. A job with a priority of 0 is higher priority than one with 10.
精彩评论