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_requeue! ⇒ Object
- #report_success! ⇒ Object
Constructor Details
#initialize(duration:) ⇒ Timeout
Returns a new instance of Timeout.
29 30 31 32 33 |
# File 'lib/ci/queue/circuit_breaker.rb', line 29 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.
27 28 29 |
# File 'lib/ci/queue/circuit_breaker.rb', line 27 def closes_at @closes_at end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
27 28 29 |
# File 'lib/ci/queue/circuit_breaker.rb', line 27 def duration @duration end |
#opened_at ⇒ Object (readonly)
Returns the value of attribute opened_at.
27 28 29 |
# File 'lib/ci/queue/circuit_breaker.rb', line 27 def opened_at @opened_at end |
Instance Method Details
#message ⇒ Object
48 49 50 |
# File 'lib/ci/queue/circuit_breaker.rb', line 48 def "This worker is exiting early because it reached its timeout of #{duration} seconds" end |
#open? ⇒ Boolean
44 45 46 |
# File 'lib/ci/queue/circuit_breaker.rb', line 44 def open? closes_at < end |
#report_failure! ⇒ Object
35 36 |
# File 'lib/ci/queue/circuit_breaker.rb', line 35 def report_failure! end |
#report_requeue! ⇒ Object
38 39 |
# File 'lib/ci/queue/circuit_breaker.rb', line 38 def report_requeue! end |
#report_success! ⇒ Object
41 42 |
# File 'lib/ci/queue/circuit_breaker.rb', line 41 def report_success! end |