Looking for an explanation into the delayed_job
gem.
I understand it schedules and keeps a list of tasks that need to be done, and that those tasks can be created via the active_job interface.
What I don't understand is what starts the taskrunner
or whatever it is that starts going through the list of jobs in the delayed_job table. Am I able to use the whenever
gem to do this and call it as a chron job? Or should I be using the daemons
gem? If so, what is the difference between daemons
gem and whenever
?
I am just a bit confused in all of this.
Lastly, I use heroku for staging, and a vpn managed via capistrano. How would that play into this?
Thank you.
There is a delayed_job
script for that It needs to be run as a separate process.
script/delayed_job
can be used to manage a background process which will start working off jobs.To do so, add
gem "daemons"
to yourGemfile
and make sure you've run rails generate delayed_job.
https://github.com/collectiveidea/delayed_job#running-jobs
For heroku, see docs
You need to update the Procfile
with:
worker: rake jobs:work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.