私はherokuでdelayed_jobを動作させようとしています。フォローしてた
https://devcenter.heroku.com/articles/delayed-jobおよび https://devcenter.heroku.com/articles/procfile
ルートに Procfile を作成して渡しました
worker: rake jobs:work
私のdelayed_jobは、どちらかを実行すると開発マシンで動作します
rake jobs:work
foreman start
ただし、heroku では、delayed_jobs が見つからないようです。私が走るとき
heroku ps
それは言う
Process State Command
-------- ---------- ---------------------------------
run.1 up for 27m bundle exec rails console
web.1 up for 28m bundle exec rails server -p $PORT
worker.1 up for 28m rake jobs:work
私はコマンドをやった
heroku ps:scale worker=1
以前に(もう一度やる必要はないと思います...)
私のジョブが実行されているかどうかを確認するためだけに(実行する必要があります)、私はやった
heroku console
irb(main):001:0> Delayed::Job.all
しかし、これは私に戻ります
Delayed::Backend::ActiveRecord::Job Load (1.4ms) SELECT "delayed_jobs".* FROM "delayed_jobs" => []
delayed_job が見つからないようです。
私のコードでは、次のようなものを実行しました
$index.document(@lesson.id).delay.update_variables({ 0 => new_score})
およびdelayed_jobは私の開発で機能します。
私はただやって問題を切り分けようとしました
heroku run bundle exec rake jobs:work
しかし吐き出すのは…
Running bundle exec rake jobs:work attached to terminal... up, run.2
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
[Worker(host:39da7fc7-7b64-49c1-8e8c-36242e705abf pid:7)] Starting job worker
実行しようとすると、本番環境で停止するのはなぜですか?
ありがとうございました。