Sha256: 1c5867def680d4e3a61585fe836cdf64506a6dc95e23cac6b201842d39d5189e

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

## Circuit Breaker
  A circuit breaker which terminates a connection or block of code from executing when it reaches the failure threshold and a percentage. Also it gets reset when a connection succeeds. It also keeps monitoring if connections are working again by checking if it has attained a time to retry.

## Installation

  ```
  gem install circuit_breaker-ruby
  ```

## Usage

  ```
  circuit_breaker = CircuitBreaker::Shield.new(
    invocation_timeout: 1,
    failure_threshold: 2,
    failure_threshold_percentage, 0.2,
    retry_timeout: 10
  )
  circuit_breaker.protect { sleep(10) }
  ```

### Running the specs

  ```
  bundle exec rspec spec
  ```

### Configuration

Add the following configuration to config/initializers/circuit_breaker.rb. These are the default values.

  ```
  CircuitBreaker.configure do |cb|
    cb.failure_threshold = 10
    cb.failure_threshold_percentage = 0.5
    cb.invocation_timeout = 10
    cb.retry_timeout = 60
  end
  ```

### Contributing

If you have any issues with circuit_breaker-ruby,
or feature requests,
please [add an issue](https://github.com/scripbox/circuit_breaker-ruby/issues) on GitHub
or fork the project and send a pull request.
Please include passing specs with all pull requests.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
circuit_breaker-ruby-0.1.1 README.md
circuit_breaker-ruby-0.1 README.md