Sidekiq - 重新安排失败的工作 [英] Sidekiq - Reschedule failed job

查看:45
本文介绍了Sidekiq - 重新安排失败的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个后台工作,使用 Sidekiq 连接到我的另一个服务,如下所示:

I have a background job using Sidekiq connecting to another service of mine like this:

  def perform(id)
      user = ABCClient.instance.user(id)
      ...
  end

有时这个 ABCClient 会关闭,我想在这种情况下重新安排执行"工作.像这样:

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

推荐答案

https://github.com/mperham/sidekiq/wiki/Scheduled-Jobs

<代码>救援 =>电子self.class.perform_in(5.minutes, id)结尾

这篇关于Sidekiq - 重新安排失败的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆