Q:

How to handle job failure properly in sidekiq

I have an application that does some processing on db data, sometimes I have optimistic concurrency error between two threads. How should I handle it with sidekiq?
For now I throw the exception to fail the job and let the sidekiq retry later, but maybe it is not optimal?
Is there any other method to fail a job more gracefully?
Cheers

A:

This method is normal solution, the only thing that you may want to do, is to update retry time. Just add to your worker.
sidekiq_retry_in do |count|
  10 * (count + 1) # (i.e. 10, 20, 30, 40)
end

More info in sidekiq docs: https://github.com/mperham/sidekiq/wiki/Error-Handling

