1

定期的に実行される Rufus の「すべてのジョブ」がありますが、タスクの実行に失敗する場合があります。

失敗した場合、次のサイクルまで待つのではなく、すぐに再試行のスケジュールを変更したいと考えています。

class PollProducts

  def initialize()
  end

  def call(job)
    puts "Updating products"

    begin
      # Do something that might fail
      raise if rand(3) == 1
    rescue Exception => e
      puts "Request failed - recheduling: #{e}"
      # job.in("5s") <-- What can I do?
    end
  end
end

scheduler.every '6h', PollProducts.new, :first_in => '5s', :blocking => true

これは可能ですか?

4

1 に答える 1

2

これは私にとってはうまくいきました:

job.scheduler.in '5s', self
于 2012-03-02T00:06:06.940 に答える