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