定期的に実行される 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
これは可能ですか?