SimpleCircuitBreaker
Overview
Simple Ruby implementation of the Circuit Breaker design pattern.
Usage
failure_threshold = 3 # Trip the circuit after 3 consecutive failures.
retry_timeout = 10 # Retry on an open circuit after 10 seconds.
circuit_breaker = SimpleCircuitBreaker.new(failure_threshold, retry_timeout)
circuit_breaker.handle do
FakeClient.new.request
end
SimpleCircuitBreaker#handle
raises a SimpleCircuitBreaker::Error
when the
circuit is open.
Testing
Run the tests with
rake
Authors
Julius Volz ([email protected]), Tobias Schmidt ([email protected]).
Contributing
Pull requests welcome!