我无法在经过验证的heroku帐户上运行排队的delayed_jobs。以下是分类:
当我在heroku 上调用delayed_job时
# 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/ruby-1.9.2-p0@rails303/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/ruby-1.9.2-p0@rails303/gems/heroku-2.2.1/lib/heroku/command.rb:116:in `run'
from /Users/jaimeohm/.rvm/gems/ruby-1.9.2-p0@rails303/gems/heroku-2.2.1/bin/heroku:14:in `<top (required)>'
from /Users/jaimeohm/.rvm/gems/ruby-1.9.2-p0@rails303/bin/heroku:19:in `load'
from /Users/jaimeohm/.rvm/gems/ruby-1.9.2-p0@rails303/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现在已经修复了Heroku gem v2.2.2版本中的这个错误。