Rails延迟作业:作业未从表中运行

时间:2015-12-15 08:41:40

标签: ruby-on-rails delayed-job

我使用命令RAILS_ENV=production bin/delayed_job -n 5 start启动延迟作业。延迟作业正在执行繁重的数据库操作,每个延迟的作业过程花费将近15分钟才能完成。

出于测试目的,我同时运行了3个作业,其中两个作业成功处理,剩下的1个作业未处理。此作业位于延迟的作业表中,但仍未运行。

***********************delayed job log********************************

er(delayed_job.4 host:ip-172-31-6-58 pid:1524)] Starting job worker
I, [2015-12-15T05:36:26.154690 #1498]  INFO -- : 2015-12-15T05:36:26+0000: [Worker(delayed_job.0 host:ip-172-31-6-58 pid:1498)] Job QrCodeGenerator (id=1) RUNNING
I, [2015-12-15T05:36:26.229763 #1504]  INFO -- : 2015-12-15T05:36:26+0000: [Worker(delayed_job.1 host:ip-172-31-6-58 pid:1504)] Job QrCodeGenerator (id=2) RUNNING
I, [2015-12-15T05:36:41.322419 #1510]  INFO -- : 2015-12-15T05:36:41+0000: [Worker(delayed_job.2 host:ip-172-31-6-58 pid:1510)] Job QrCodeGenerator (id=3) RUNNING
I, [2015-12-15T05:50:51.485299 #1510]  INFO -- : 2015-12-15T05:50:51+0000: [Worker(delayed_job.2 host:ip-172-31-6-58 pid:1510)] Job QrCodeGenerator (id=3) COMPLETED after 850.1627
I, [2015-12-15T05:50:51.488960 #1510]  INFO -- : 2015-12-15T05:50:51+0000: [Worker(delayed_job.2 host:ip-172-31-6-58 pid:1510)] 1 jobs processed at 0.0012 j/s, 0 failed
I, [2015-12-15T05:50:59.107773 #1498]  INFO -- : 2015-12-15T05:50:59+0000: [Worker(delayed_job.0 host:ip-172-31-6-58 pid:1498)] Job QrCodeGenerator (id=1) COMPLETED after 872.9529
I, [2015-12-15T05:50:59.108821 #1498]  INFO -- : 2015-12-15T05:50:59+0000: [Worker(delayed_job.0 host:ip-172-31-6-58 pid:1498)] 1 jobs processed at 0.0011 j/s, 0 failed

*********************remaining entry with Delayed::Job.all*************

2.0.0-p598 :001 > Delayed::Job.all
 => #<ActiveRecord::Relation [#<Delayed::Backend::ActiveRecord::Job id: 2, priority: 0, attempts: 0, handler: "--- !ruby/struct:QrCodeGenerator\nclient: !ruby/obj...", last_error: nil, run_at: "2015-12-15 08:17:22", locked_at: "2015-12-15 05:36:26", failed_at: nil, locked_by: "delayed_job.1 host:ip-172-31-6-58 pid:1504", queue: nil, created_at: "2015-12-15 05:36:23", updated_at: "2015-12-15 08:17:26">]>

请帮忙。

谢谢,

0 个答案:

没有答案