问题
I have a background job using Sidekiq connecting to another service of mine like this:
def perform(id)
user = ABCClient.instance.user(id)
...
end
Sometimes this ABCClient is down and I would like to reschedule the "perform" job in this case. Like this:
def perform(id)
begin
user = ABCClient.instance.user(id)
rescue => e
# Reschedule job
end
...
end
回答1:
https://github.com/mperham/sidekiq/wiki/Scheduled-Jobs
rescue => e
self.class.perform_in(5.minutes, id)
end
来源:https://stackoverflow.com/questions/25937654/sidekiq-reschedule-failed-job