From bdfcb0da192bd1282e4e00157f47bb18a02dd568 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 31 Oct 2021 15:07:27 +0100 Subject: [PATCH] Reset previous exception if retrying command execution --- app/models/runner.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/runner.rb b/app/models/runner.rb index c9772fc2..e0bebd5e 100644 --- a/app/models/runner.rb +++ b/app/models/runner.rb @@ -98,7 +98,12 @@ class Runner < ApplicationRecord try += 1 request_new_id save - retry if try == 1 + + if try == 1 + # Reset the variable. This is required to prevent raising an outdated exception after a successful second try + e = nil + retry + end Rails.logger.debug { "Running command `#{command}` failed for the second time: #{e.message}" } output.merge!(status: :failed, container_execution_time: e.execution_duration)