Class: CI::Queue::CircuitBreaker::Timeout
- Inherits:
-
Object
- Object
- CI::Queue::CircuitBreaker::Timeout
- Defined in:
- lib/ci/queue/circuit_breaker.rb
Instance Attribute Summary collapse
-
#closes_at ⇒ Object
readonly
Returns the value of attribute closes_at.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#opened_at ⇒ Object
readonly
Returns the value of attribute opened_at.
Instance Method Summary collapse
-
#initialize(duration:) ⇒ Timeout
constructor
A new instance of Timeout.
- #message ⇒ Object
- #open? ⇒ Boolean
- #report_failure! ⇒ Object
- #report_success! ⇒ Object
Constructor Details
#initialize(duration:) ⇒ Timeout
Returns a new instance of Timeout.
26 27 28 29 30 |
# File 'lib/ci/queue/circuit_breaker.rb', line 26 def initialize(duration:) @duration = duration @opened_at = @closes_at = @opened_at + duration end |
Instance Attribute Details
#closes_at ⇒ Object (readonly)
Returns the value of attribute closes_at.
24 25 26 |
# File 'lib/ci/queue/circuit_breaker.rb', line 24 def closes_at @closes_at end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
24 25 26 |
# File 'lib/ci/queue/circuit_breaker.rb', line 24 def duration @duration end |
#opened_at ⇒ Object (readonly)
Returns the value of attribute opened_at.
24 25 26 |
# File 'lib/ci/queue/circuit_breaker.rb', line 24 def opened_at @opened_at end |
Instance Method Details
#message ⇒ Object
42 43 44 |
# File 'lib/ci/queue/circuit_breaker.rb', line 42 def "This worker is exiting early because it reached its timeout of #{duration} seconds" end |
#open? ⇒ Boolean
38 39 40 |
# File 'lib/ci/queue/circuit_breaker.rb', line 38 def open? closes_at < end |
#report_failure! ⇒ Object
32 33 |
# File 'lib/ci/queue/circuit_breaker.rb', line 32 def report_failure! end |
#report_success! ⇒ Object
35 36 |
# File 'lib/ci/queue/circuit_breaker.rb', line 35 def report_success! end |