Skip to content

Commit

Permalink
Fix early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBr committed Jan 3, 2024
1 parent d7b3796 commit f048c49
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ruby/lib/minitest/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,19 @@ def run_from_queue(reporter, *)
queue.report_success!
end

requeued = false
acknowledged = false
if failed && CI::Queue.requeueable?(result) && queue.requeue(example)
requeued = true
result.requeue!
reporter.record(result)
elsif queue.acknowledge(example) || !failed
elsif (acknowledged = queue.acknowledge(example)) || !failed
# If the test was already acknowledged by another worker (we timed out)
# Then we only record it if it is successful.
reporter.record(result)
end

if !requeued && failed
# If the test failed and we acknowledged it, we know it's a terminal failure and
# we have to record it for our circuit breaker.
if failed && acknowledged
queue.increment_test_failed
end
end
Expand Down

0 comments on commit f048c49

Please sign in to comment.