Hi, kindly help me find a solution for the issues i am facing with delayed_job :-
this is my initializers file:
# config/initializers/delayed_job_config.rb
Delayed::Worker.sleep_delay = 3
Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.max_attempts = 3
Delayed::Worker.max_run_time = 5.minutes
Delayed::Worker.read_ahead = 10
Delayed::Worker.default_queue_name = 'default'
Delayed::Worker.delay_jobs = !Rails.env.test?
if Rails.env.production?
system "RAILS_ENV=production #{Rails.root.join('script','delayed_job')} stop"
system "RAILS_ENV=production #{Rails.root.join('script','delayed_job')} -n 2 start"
else
# system "RAILS_ENV=development #{Rails.root.join('script','delayed_job')} stop"
# system "RAILS_ENV=development #{Rails.root.join('script','delayed_job')} -n 2 start"
end
There are multiple issues that i am facing with the delayed_job config file:
1.Jobs are getting deleted after 1 failure only which ideally should not get deleted at all as seen from above config file at least there must be 3 attempts.
2. Also i have to run RAILS_ENV=production script/delayed_job stop , RAILS_ENV=production script/delayed_job -n 2 start manually which again should run from config file itself.
3. Timeout::Error: execution expired message for the failed jobs.(there is no heavy jobs yet it is showing this error which i believe may be misleading)
Rails version:- 3.2.15 Ruby version:- ruby 1.9.3p551 OS version: Linux version 3.14.48-33.39.amzn1.x86_64 (mockbuild@gobi-build-60007) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) )
Gem Versions:-
| daemons | 1.1.9 |
| delayed_job | 4.0.0 |
| delayed_job_active_record | 4.0.0 |
Note:- While running in development environment none of the above issues exist but on production environment issues occur.
Any help would be appreciated to find the cause of these issues.(already googled a lot but yet to find the working solution)
Thanks