开发者

How do I prioritize a job created with the delayed_jobs gem?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜