Sha256: 313909b084024cad97421da1be9082f4b9b3ae9e3e36fb1f885fd61e0960eb0c

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 Bytes

Contents

require 'uri'
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

    def circuit(service_name, options)
      circuit = (cached_circuits[service_name] ||= CircuitBreaker.new(service_name, options))

      return circuit unless block_given?

      circuit.run(circuitbox_exceptions: false) { yield }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
circuitbox-2.0.0.pre3 lib/circuitbox.rb
circuitbox-2.0.0.pre2 lib/circuitbox.rb