From bf833382a2736dee61aefdb215fee0f729120314 Mon Sep 17 00:00:00 2001 From: Adrianna Chang Date: Tue, 23 Feb 2021 15:51:39 -0500 Subject: [PATCH] Try rescuing exceptions and reenqueuing if necessary before re-raising --- lib/job-iteration/iteration.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/job-iteration/iteration.rb b/lib/job-iteration/iteration.rb index 97b947b0..7f0cb9c5 100644 --- a/lib/job-iteration/iteration.rb +++ b/lib/job-iteration/iteration.rb @@ -18,6 +18,11 @@ module Iteration define_callbacks :shutdown define_callbacks :complete + rescue_from(Exception) do + reenqueue_iteration_job if reenqueue_iteration_job? + raise + end + after_perform(prepend: true, if: :reenqueue_iteration_job?) { reenqueue_iteration_job } end