Delayed Job not picking job from table

前提是你 提交于 2019-12-11 20:42:05

问题


In my current project I am doing some process in background by using Delayed Job gem. It's working fine in local but in production jobs are inserted into Delayed Job table but DJ not picking few jobs from that DJ table. Could any one have idea how Delayed Job will pick up jobs from Delayed Job table.

Below is the Delayed job code in my project:

Delayed::Job.enqueue(ProposalJob.new(current_user, @proposal, request.host, params[:proposal][:revision_notes], params[:proposal][:close_date]), :queue => 'publishing')

Delayed job configuration in my project:

Delayed::Worker.destroy_failed_jobs = false Delayed::Worker.max_attempts = 3 Delayed::Worker.max_run_time = 1.hours Delayed::Worker.read_ahead = 10


回答1:


It's not possible that delayed job will pick some job and not pick other. Either it will process all job or not process any. If it process any job then your configuration is right.

There might be issue due to Delayed::Worker.destroy_failed_jobs = false this configuration. if your any job fails three times then it will not get deleted from your delayed job table. Because of due to this you might feel that this jobs not get processed.

Try debug your delayed job code with puts.

You can also try https://github.com/resque/resque-scheduler this will provide visual way to watch delayed jobs.



来源:https://stackoverflow.com/questions/26772330/delayed-job-not-picking-job-from-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!