I would like Airbrake to only be notified of errors when the retries are exhausted, but I can't seem to think of a way to implement it...
I can add a sidekiq_retries_exhausted hook to send the error to AirBrake but the only way I can think of catching the actual failures is to add a middleware that swallows the error, but then, the job will be marked as a success if there is no error... then there will never be any retries..
Hope that makes sense!
perform
code in a begin/rescue block, and then log any errors that arise that would have resulted in a retry, and instead raise a generic exception likeWorkerPerformError
and add that to your ignored exceptions list. That way the original exception is suppressed and the custom exception triggers a retry. I'm going to have to implement something similar to this on a recent project I inherited so I'll post a more thought-out solution when I have. – Surtout