Search code examples
ruby-on-railssidekiq

Couldn't find Post without ID sidekiq error


I can't figure out what's going on with sidekiq. I could've swore this worked yesterday, but I must have been dreaming.

Here's my worker class:

class TagPostWorker
  include Sidekiq::Worker
  sidekiq_options queue: "tag"
  sidekiq_options retry: false

  def perform(options = {})
      current_user = User.find(options[:user_id])
  end

end

I've tried running this command on my show method in the Post:

TagPostWorker.perform_async({:user_id => current_user.id})

But I get this error:

2013-08-17T22:45:45Z 4029 TID-ors6jfr54 TagPostWorker JID-ae203958bb3bcee01c8f83ef INFO: start
2013-08-17T22:45:45Z 4029 TID-ors6jfr54 TagPostWorker JID-ae203958bb3bcee01c8f83ef INFO: fail: 0.003 sec
2013-08-17T22:45:45Z 4029 TID-ors6jfr54 WARN: {"retry"=>false, "queue"=>"tag", "class"=>"TagPostWorker", "args"=>[{"user_id"=>7}], "jid"=>"ae203958bb3bcee01c8f83ef", "enqueued_at"=>1376779545.9099338}
2013-08-17T22:45:45Z 4029 TID-ors6jfr54 WARN: Couldn't find Post without an ID

I don't understand how sidekiq could even be attempting to a Post since I'm not even calling it in the perform method. Any ideas what could be going on?

Any help is appreciated.


Solution

  • Also strange, I could've sworn I restarted Rails/sidekiq.

    But I renamed the worker to TagWorker, restarted Rails/sidekiq and it started working again!