我在Rails 4应用程序中有以下工作程序:
class CallbackWorker
include Sidekiq::Worker
def perform(user_id)
user = User.find(user_id)
Rails.logger.info "[CallbackWorker] Initiating callback check for #{user.full_name}"
callback = user.callbacks.next.first
Rails.logger.info "[CallbackWorker] Next callback: #{callback.inspect}"
return unless callback
Rails.logger.info "[CallbackWorker] Calling user"
callback.execute
end
end
这就是这样称呼的:
def available!
if unavailable?
events.create! state: "available"
hours.create! action: "start"
end
CallbackWorker.perform_async(self.id)
end
但是我在Sidekiq进程中遇到以下错误:
2013-10-31T00:48:09Z 21627 TID-ouq3ot5mw WARN: {"retry"=>true, "queue"=>"default", "class"=>"CallbackWorker", "args"=>[1], "jid"=>"f5ff02372751c820aa7c8ed5", "enqueued_at"=>1383180489.304018}
2013-10-31T00:48:09Z 21627 TID-ouq3ot5mw WARN: undefined method `jid=' for #<CallbackWorker:0x007f898d3a3748>
2013-10-31T00:48:09Z 21627 TID-ouq3ot5mw WARN: /Users/fcoury/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:44:in `block in process'
/Users/fcoury/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:83:in `do_defer'
/Users/fcoury/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:37:in `process'
/Users/fcoury/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.0/lib/celluloid/calls.rb:25:in `public_send'
/Users/fcoury/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.0/lib/celluloid/calls.rb:25:in `dispatch'
/Users/fcoury/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.0/lib/celluloid/calls.rb:122:in `dispatch'
知道为什么要为我的工人设置jid?
答案 0 :(得分:1)
我使用的是Sidekiq 2.13.0。升级到2.16.0修复了问题。