lib/ci/queue/static.rb in ci-queue-0.17.2 vs lib/ci/queue/static.rb in ci-queue-0.18.0
- old
+ new
@@ -48,11 +48,11 @@
def size
@queue.size
end
def poll
- while !config.circuit_breakers.any?(&:open?) && test = @queue.shift
+ while config.circuit_breakers.none?(&:open?) && !max_test_failed? && test = @queue.shift
yield index.fetch(test)
end
end
def exhausted?
@@ -62,12 +62,27 @@
def acknowledge(test)
@progress += 1
true
end
+ def increment_test_failed
+ @test_failed = test_failed + 1
+ end
+
+ def test_failed
+ @test_failed ||= 0
+ end
+
+ def max_test_failed?
+ return false if config.max_test_failed.nil?
+
+ test_failed >= config.max_test_failed
+ end
+
def requeue(test)
test_key = test.id
return false unless should_requeue?(test_key)
+
requeues[test_key] += 1
@queue.unshift(test_key)
true
end