class Semian::CircuitBreaker

def maybe_with_half_open_resource_timeout(resource, &block)

def maybe_with_half_open_resource_timeout(resource, &block)
  result =
    if half_open? && @half_open_resource_timeout && resource.respond_to?(:with_resource_timeout)
      resource.with_resource_timeout(@half_open_resource_timeout) do
        block.call
      end
    else
      block.call
    end
  result
end