我试图让延迟工作在 Heroku 工作。我一直在关注
https://devcenter.heroku.com/articles/delayed-job和 https://devcenter.heroku.com/articles/procfile
我在我的根目录上创建了一个 Procfile 并传入
worker: rake jobs:work
当我这样做时,我的延迟作业在我的开发机器上工作
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})
delay_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
为什么当我尝试运行它时它会停止生产?
谢谢你。