3

私は本当に簡単な仕事をしています:

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'

なぜ起こっているのでしょうか?

ありがとう!

4

2 に答える 2

2

はいスカイ。あなたはそれを再起動する必要があることについて正しいです。

すでに削除されたディレクトリから実行しようとした後に、このエラーを受け取った人もいます。

データベースを切り替えてサーバーを実行したままにした後、このエラーを受け取りました。古いサーバー情報がまだ表示されていましたが、このエラーが発生していました。Rails サーバーを再起動すると、すべてが新しいデータベースで正常に動作します。

基本的に、これはサーバーの状態が大きく変化したことを意味し、環境をリセット/再起動する必要があります。

于 2014-04-27T17:32:21.860 に答える
1

実稼働環境でも同じ問題が発生し始めました。いくつかの調査の結果、これは、カピストラーノの展開ごとに resque ワーカーが適切に再起動されなかったことが原因であることがわかりました。

于 2013-06-10T18:13:03.123 に答える