lib/circuitbox.rb in circuitbox-2.0.0.pre4 vs lib/circuitbox.rb in circuitbox-2.0.0.pre5
- old
+ new
@@ -1,24 +1,22 @@
# frozen_string_literal: true
-require 'logger'
-
require_relative 'circuitbox/version'
require_relative 'circuitbox/circuit_breaker'
require_relative 'circuitbox/errors/error'
require_relative 'circuitbox/errors/open_circuit_error'
require_relative 'circuitbox/errors/service_failure_error'
require_relative 'circuitbox/configuration'
class Circuitbox
- class << self
- include Configuration
+ extend Configuration
+ class << self
def circuit(service_name, options, &block)
- circuit = (cached_circuits[service_name] ||= CircuitBreaker.new(service_name, options))
+ circuit = find_or_create_circuit_breaker(service_name, options)
return circuit unless block
- circuit.run(circuitbox_exceptions: false, &block)
+ circuit.run(exception: false, &block)
end
end
end