class Gracefully::ShortCircuitedCommand

Public Class Methods

new(*args, &block) click to toggle source
Calls superclass method Gracefully::Command::new
# File lib/gracefully/short_circuited_command.rb, line 7
def initialize(*args, &block)
  super

  @circuit_breaker = Gracefully::CircuitBreaker.new(
    try_close_after: @options[:try_close_after],
    health: Gracefully::ConsecutiveFailuresBasedHealth.new(
      become_unhealthy_after_consecutive_failures: @options[:allowed_failures],
      counter: @options[:counter]
    )
  )
end

Public Instance Methods

call(*args, &block) click to toggle source
Calls superclass method Gracefully::Command#call
# File lib/gracefully/short_circuited_command.rb, line 19
def call(*args, &block)
  @circuit_breaker.execute { super }
end