随着delayed_jobs宝石( https://github.com/collectiveidea/delayed_job中轨),我能够排队我通知。 但我不太明白我怎么能在生产服务器上运行排队的作业。 我知道我可以只运行
$ rake jobs:work
在控制台本地服务器。 由于文档说,你就可以做到以下几点:
RAILS_ENV=production script/delayed_job start
RAILS_ENV=production script/delayed_job stop
# Runs two workers in separate processes.
RAILS_ENV=production script/delayed_job -n 2 start
RAILS_ENV=production script/delayed_job stop
# Set the --queue or --queues option to work from a particular queue.
RAILS_ENV=production script/delayed_job --queue=tracking start
RAILS_ENV=production script/delayed_job --queues=mailers,tasks start
# Runs all available jobs and the exits
RAILS_ENV=production script/delayed_job start --exit-on-complete
# or to run in the foreground
RAILS_ENV=production script/delayed_job run --exit-on-complete
我的问题是如何将它与我的Rails应用程序集成我想创建一个名为delayed_jobs.rb在配置/初始值设定为文件?
# in config/initializers/delayed_jobs
script/delayed_job start if Rails.env.production?
但我不知道这是否是做正确的方式。 谢谢