问题
By default sidekiq will retry any jobs that throw an exception. That is fine. However, I want to be able to catch that exception so that my exception handler doesn't get notified, and then retry the job. How do I accomplish this in react?
So my code looks like this:
def perform
...
rescue ExcClass => ex
# log
end
But I want to actually retry that job.
回答1:
Configure your error service client to ignore ExcClass. Sidekiq will retry, you don't get error reports.
回答2:
If I'm following your question correctly, it sounds like you may want a custom error handler to do what you want:
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 retry your jobs automatically.
Does this answer your question? It's slightly confusing. Here are the docs from which I pulled the above information.
来源:https://stackoverflow.com/questions/31123960/catch-exception-but-do-retry-with-sidekiq