Class: CI::Queue::CircuitBreaker::MaxConsecutiveFailures
- Inherits:
-
Object
- Object
- CI::Queue::CircuitBreaker::MaxConsecutiveFailures
- Defined in:
- lib/ci/queue/circuit_breaker.rb
Instance Method Summary collapse
-
#initialize(max_consecutive_failures:) ⇒ MaxConsecutiveFailures
constructor
A new instance of MaxConsecutiveFailures.
- #message ⇒ Object
- #open? ⇒ Boolean
- #report_failure! ⇒ Object
- #report_success! ⇒ Object
Constructor Details
#initialize(max_consecutive_failures:) ⇒ MaxConsecutiveFailures
Returns a new instance of MaxConsecutiveFailures.
54 55 56 57 |
# File 'lib/ci/queue/circuit_breaker.rb', line 54 def initialize(max_consecutive_failures:) @max = max_consecutive_failures @consecutive_failures = 0 end |
Instance Method Details
#message ⇒ Object
71 72 73 |
# File 'lib/ci/queue/circuit_breaker.rb', line 71 def 'This worker is exiting early because it encountered too many consecutive test failures, probably because of some corrupted state.' end |
#open? ⇒ Boolean
67 68 69 |
# File 'lib/ci/queue/circuit_breaker.rb', line 67 def open? @consecutive_failures >= @max end |
#report_failure! ⇒ Object
59 60 61 |
# File 'lib/ci/queue/circuit_breaker.rb', line 59 def report_failure! @consecutive_failures += 1 end |
#report_success! ⇒ Object
63 64 65 |
# File 'lib/ci/queue/circuit_breaker.rb', line 63 def report_success! @consecutive_failures = 0 end |