I'm using delayed_job and I am able to run jobs using rake jobs:work but using the daemonized version, it does nothing although I see it in the process list.
I'm using:
I'm running delayed_job using:
unix>RAILS_ENV=development script/delayed_job start
It could be a problem loading a custom job class file. To test that, try this:
rails console --sandbox
.job = Delayed::Job.first
.YAML.load(job.handler)
. If you get an error that looks like this: ArgumentError: undefined class/module MyCustomClass
, it's probably a problem loading your custom jobrequire 'My_Custom_Class
. Then run the YAML.load(job.handler)
command again. If this returns the appropriate object it's definitely a class loading problem.To fix the problem create the file config/initializers/custom.rb
and in it put require 'My_Custom_Class'
.
You should then be able to run rake jobs::workoff
and get something that looks like this:
[Worker(host:my.host pid:5085)] Starting job worker
[Worker(host:my.host pid:5085)] MyCustomJob completed after 0.0774
[Worker(host:my.host pid:5085)] 1 jobs processed at 9.1935 j/s, 0 failed ...
[Worker(host:my.host pid:5085)] No more jobs available. Exiting
To answer your question we may need more information.
Are jobs added to database? Are there any errors in jobs?
What's the result of RAILS_ENV=development script/delayed_job status
as I already mentioned?
Second, did you went through the most common problems Wiki page?
https://github.com/collectiveidea/delayed_job/wiki/Common-problems
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With