Use Delayed::Job to manage multiple job queues

▼魔方 西西 提交于 2019-11-30 19:08:42

Since then http://github.com/collectiveidea/delayed_job has reached v3.0 and includes named queues! Excellent for simple grouped queue needs.

If you like the Delayed Job, it'd be simple enough to create multiple tables, one per queue

The worker gets it's table name from

class Job < ActiveRecord::Base
    MAX_ATTEMPTS = 25
    MAX_RUN_TIME = 4.hours
    set_table_name :delayed_jobs

So you could edit that and create one migration per table. And then when you start your jobs, you'll start one worker per queue.

Source: http://github.com/tobi/delayed_job

Resque is a job queue library that supports multiple queues.

Ben Jackson

Answer is here:

Delayed_job - Multiple parallel queues?

Use the -i option in delayed_job (rather than the -n option used for spawning multiple workers) to set a unique ID for each job.

DJ workers just grab the first job from the queue (there's only one) and do it. Each worker is the same as any other. You can run multiple workers, but they will all work from the same queue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!