【问题标题】:Resque job returning with error: "No such file or directory - getcwd"Resque 作业返回错误:“没有这样的文件或目录 - getcwd”
【发布时间】:2014-04-28 01:32:21
【问题描述】:

我的工作很简单:

class MyJob
  @queue = :high

  def self.perform(user_id)
    user = User.find(user_id)
    MyMailer.send_email(user).deliver
  end

end

如果我手动运行它MyJob.perform(some_id)它会完美运行。但是,当 Rescue 执行它时,它会返回此错误:

Exception
    Errno::ENOENT Error
    No such file or directory - getcwd

 shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:221:in `expand_path'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:221:in `initialize'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:251:in `new'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:251:in `instances'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:16:in `<class:LookupContext>'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:12:in `<module:ActionView>'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:5:in `<top (required)>'  shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/view_paths.rb:45:in `lookup_context'  shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:456:in `process'  shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:452:in `initialize'  shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:439:in `new'  shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:439:in `method_missing'  releases/1111111111111/app/jobs/my_job.rb:6:in `perform'

有什么想法为什么会发生?

谢谢!

【问题讨论】:

    标签: ruby-on-rails resque


    【解决方案1】:

    是的天空。你说得对,它需要重新启动。

    有些人在尝试从已删除的目录运行后收到此错误。

    我在切换数据库并使服务器保持运行后收到此错误。旧的服务器信息仍在显示,但我收到此错误。重新启动我的 Rails 服务器,新数据库一切正常。

    基本上这意味着服务器上的状态发生了重大变化,需要重置/重新启动您的环境。

    【讨论】:

      【解决方案2】:

      我开始在我的生产环境中遇到同样的问题。经过一番调查,我发现这是由于我的 resque 工作人员未能在每次 capistrano 部署时正确重新启动造成的。

      【讨论】:

      • 如何手动重启它们? rake resque:scheduler RAILS_ENV=production ????
      • Sky mayhew 你是怎么解决这个问题的?
      猜你喜欢
      • 2014-02-25
      • 2012-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-03
      • 2014-05-30
      相关资源
      最近更新 更多