Throw exception but try again with Sidekiq
By default, sidekiq will repeat any jobs that throw an exception. This is normal. However, I want to catch this exception so that the exception handler is not notified and then retry the job. How to do this in response?
So my code looks like this:
def perform
...
rescue ExcClass => ex
# log
end
But I want to actually repeat this work.
+3
source to share
2 answers
If I'm asking your question correctly, it looks like you can use your own error handler:
Sidekiq.configure_server do |config|
config.error_handlers << Proc.new {|exception,context_hash| MyErrorService.notify(exception,context_hash) }
end
By default, Sidekiq will continue to repeat your assignments automatically.
Does this answer your question? This is a little confusing. Here are the docs from which I pulled the above information.
+1
source to share