Skip to content
avit edited this page Jan 9, 2013 · 19 revisions

I hate to say it but some of your workers will crash when processing messages. It's true.

Sidekiq provides two critical features to handle this unfortunate eventuality:

  1. Exception notification - Sidekiq integrates with these notification services: Airbrake, Exceptional, ExceptionNotifier (the exception_notification gem now), and Honeybadger. When a worker raises an error, the error and message contents will be sent to the service so that you can be notified and fix the bug.
  2. Automatic failure retry - Sidekiq will retry processing failures with an exponential backoff using the formula retry_count**4 + 15 (i.e. 15, 16, 31, 96, 271, ... seconds). It will perform 25 retries over approximately 4 days. Assuming you deploy a bug fix within that time, the message will get retried and successfully processed. After 25 times, Sidekiq will drop the message assuming that it will never be successfully processed.

You can disable retry support for a particular worker:

class NonRetryableWorker
  include Sidekiq::Worker
  sidekiq_options :retry => false

  def perform(...)
  end
end

Alternatively, you can specify the number of retries for a particular worker:

class NonRetryableWorker
  include Sidekiq::Worker
  sidekiq_options :retry => 5 # Only five retries and then we're outta here!

  def perform(...)
  end
end
Clone this wiki locally