Search code examples
ruby-on-railsruby-on-rails-4sidekiq

Error setting jid on Sidekiq worker


I have the following worker in a Rails 4 application:

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

That is called like this:

def available!
  if unavailable?
    events.create! state: "available"
    hours.create! action: "start"
  end
  CallbackWorker.perform_async(self.id)
end

But I am getting the following error on the Sidekiq process:

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'

Any idea why it's trying to set jid on my worker?


Solution

  • I was using Sidekiq 2.13.0. Upgrading to 2.16.0 fixed the problem.