class CI::Queue::CircuitBreaker::Timeout

Attributes

closes_at[R]
duration[R]
opened_at[R]

Public Class Methods

new(duration:) click to toggle source
# File lib/ci/queue/circuit_breaker.rb, line 26
def initialize(duration:)
  @duration = duration
  @opened_at = current_timestamp
  @closes_at = @opened_at + duration
end

Public Instance Methods

message() click to toggle source
# File lib/ci/queue/circuit_breaker.rb, line 42
def message
  "This worker is exiting early because it reached its timeout of #{duration} seconds"
end
open?() click to toggle source
# File lib/ci/queue/circuit_breaker.rb, line 38
def open?
  closes_at < current_timestamp
end
report_failure!() click to toggle source
# File lib/ci/queue/circuit_breaker.rb, line 32
def report_failure!
end
report_success!() click to toggle source
# File lib/ci/queue/circuit_breaker.rb, line 35
def report_success!
end

Private Instance Methods

current_timestamp() click to toggle source
# File lib/ci/queue/circuit_breaker.rb, line 48
def current_timestamp
  Time.now.to_i
end