Search code examples
ruby-on-railssidekiq

Sidekiq Worker fails still it shows job completed


I'm using Sidekiq for processing emails and sms jobs. I have observed some strange behaviour in Sidekiq, where because of some missing data or something worker crashes in between, and mail will not be processed but still Sidekiq shows "jobs completed" and increases processed count in status. What is this behaviour? what am i missing here?


Solution

  • Sidekiq only marks a job as failed, when an exception was raised. It can't figure out if "something wasn't properly done".

    Make sure to raise an error in your job, if something unexpected happens or nothing happens at all. For example use the bang version (!) of methods like #create! over #create.

    Also there's the chance that the job was retried and succeeded in a later retry.