forked from sidekiq/sidekiq
-
Notifications
You must be signed in to change notification settings - Fork 0
Error Handling
Axsuul edited this page Aug 5, 2012
·
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:
- Exception notification - Sidekiq integrates with the top three exception notification services in the Ruby world: Airbrake, Exceptional and ExceptionNotifier (the exception_notification gem now). 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.
-
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 20 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.
- Automatic retry will only happen for exceptions that inherit from
StandardError
(#332)
You can disable retry support for a particular worker:
class NonRetryableWorker
include Sidekiq::Worker
sidekiq_options :retry => false
def perform(...)
end
end