尽管立即从delay_jobs表中消失了,延迟的作业仍未执行 [英] Delayed job not executed despite disappearing from delayed_jobs table immediately

查看:79
本文介绍了尽管立即从delay_jobs表中消失了,延迟的作业仍未执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在指令之后执行了我的Rails应用程序中的延迟工作。

I implemented a delayed job in my Rails application, following the instructions.


  1. 我启动Rails应用程序

  2. 我单击一个启动延迟工作的链接

  3. 该作业在数据库的 delayed_jobs 表中可见

  4. 我运行 rakejobs:work

  5. 工作从桌子上消失了,所以我想工作已经完成了

  6. 但是问题: /tmp/job.log 尚未编写(作业应完成的工作)

  1. I start the Rails app
  2. I click on a link that launches the delayed job
  3. The job is visible in the database's delayed_jobs table
  4. I run rake jobs:work
  5. The job disappears from the table, so I guess the job has been performed
  6. BUT PROBLEM: /tmp/job.log has not been written (what the job should have done)

工作:

class CsvImportJob
  def perform
    File.open('/tmp/job.log', 'w') {|f| f.write("Hello") }
  end
end

通话:

job = CsvImportJob.new
job.delay.perform

日志中什么都没有。

rake jobs:work 终端说起始消息后没有任何内容:

Nothing in the logs.
The rake jobs:work terminal says nothing after its start message:

[Worker(host:nico pid:25453)] Starting job worker

当我启动工作而 rake job:work

相反,当执行 hello .delay.length 行时,delay_jobs对其进行处理并出现消息 String#length在0.0556后完成-以3.6912 j / s的速度处理1个作业,失败0个

In contrast, when the line "hello".delay.length is executed, delayed_jobs processes it and a message String#length completed after 0.0556 - 1 jobs processed at 3.6912 j/s, 0 failed does appear.

推荐答案

请参见 https:// github.com/collectiveidea/delayed_job/wiki/Common-problems#wiki-un

See https://github.com/collectiveidea/delayed_job/wiki/Common-problems#wiki-undefined_method_xxx_for_class in documentation.

即使延迟工作的作者也不知道原因。它在某种程度上取决于您所运行的Web服务器。尝试Wiki的建议。

Even delayed_job author don't know the reason. It somehow depends on the webserver you run in on. Try the wiki's recommendation.

另请参见 delayed_job:NoMethodError

这篇关于尽管立即从delay_jobs表中消失了,延迟的作业仍未执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆