2
我無法排隊等待delayed_jobs在我驗證過的heroku帳戶上運行。這裏是擊穿:Heroku + DelayedJob在'rake jobs:work'和'heroku workers 1'上失敗
當我調用的delayed_job在Heroku
# tropo_controller.rb in app/controllers
class TropoController < ApplicationController
require 'lib/event_job'
...
def sms
Delayed::Job.enqueue(EventJob.new(nil))
然後驗證delayed_job的存在
$ heroku console
>> Delayed::Job.all
[#<Delayed::Backend::ActiveRecord::Job id: 2, priority: 0, attempts: 0, handler: "--- !ruby/struct:EventJob \nevent_id: \n", last_error: nil, run_at: "2011-05-30 21:01:24", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2011-05-30 21:01:24", updated_at: "2011-05-30 21:01:24">]
並嘗試啓動一個新的工作要麼這樣
$ heroku rake jobs:work
Starting job worker
(hangs)
或這種方式
$ heroku workers 1
/Users/jaimeohm/.rvm/gems/[email protected]/gems/heroku-2.2.1/lib/heroku/command.rb:125:in `rescue in run': undefined local variable or method `args' for Heroku::Command:Module (NameError)
from /Users/jaimeohm/.rvm/gems/[email protected]/gems/heroku-2.2.1/lib/heroku/command.rb:116:in `run'
from /Users/jaimeohm/.rvm/gems/[email protected]/gems/heroku-2.2.1/bin/heroku:14:in `<top (required)>'
from /Users/jaimeohm/.rvm/gems/[email protected]/bin/heroku:19:in `load'
from /Users/jaimeohm/.rvm/gems/[email protected]/bin/heroku:19:in `<main>'
失敗。我運行gem update heroku
,重置數據庫,並重新啓動服務器,它仍然失敗。我故意排空排隊工作的執行方法
# event_job.rb in app/lib
class EventJob < Struct.new(:event_id)
def perform
# empty for now
end
end
我在想什麼?
我認爲問題來自「heroku工人1」失敗。我從其他人的帖子中找不到任何不起作用的實例。 – jaime 2011-05-31 01:03:00
其他人遇到類似的問題,這是由新版本的rake引入的錯誤引起的。這是*不*我的問題,修復不*解決我的問題。 http://stackoverflow.com/questions/6091964/delayed-job-queue-not-being-processed-on-heroku – jaime 2011-05-31 01:33:27
'heroku工作人員1'不工作是不尋常的。您可以嘗試升級到ruby-1.9.2-p180(您在每個RVM路徑中使用1.9.2-p0)。 'rvm install 1.9.2-p180' – wuputah 2011-05-31 02:47:35