我有一个使用Sidekiq连接到我的另一个服务的后台作业,如下所示:
def perform(id) user = ABCClient.instance.user(id) ... end
有时,此ABCClient关闭了,在这种情况下,我想重新安排“执行”作业。像这样:
def perform(id) begin user = ABCClient.instance.user(id) rescue => e # Reschedule job end ... end
https://github.com/mperham/sidekiq/wiki/Scheduled- Jobs
rescue => e self.class.perform_in(5.minutes, id) end