【发布时间】:2017-02-16 18:33:40
【问题描述】:
在使用延迟作业时,如何为特定队列指定一名工作人员?我知道我可以运行这个命令:
# Use the --pool option to specify a worker pool. You can use this option
# multiple times to start different numbers of workers for different queues.
# The following command will start 1 worker for the tracking queue,
# 2 workers for the mailers and tasks queues, and 2 workers for any jobs:
RAILS_ENV=production script/delayed_job --pool=tracking --pool=mailers,tasks:2 --pool=*:2 start
但是由于我们使用的是 heroku,所以我们使用了一个 procfile 来运行我们的工作人员:
worker: bundle exec foreman start -f Procfile.workers 和我们的工作文件运行作业:
worker_1: bundle exec rake jobs:work
worker_2: bundle exec rake jobs:work
然而,我想做的是:
bundle exec rake jobs:work --queue=specific_queue
并且只有一名工作人员在特定队列上工作,其他工作人员在其他队列上工作。
我怎样才能做到这一点?
【问题讨论】:
-
我的回答对你有用吗?
标签: ruby-on-rails ruby heroku delayed-job