Categories: None [Edit]
    circuit_breaker
CircuitBreaker is a relatively simple Ruby mixin that will wrap
 a call to a given service in a circuit breaker pattern.
 The circuit starts off "closed" meaning that all calls will go through.
 However, consecutive failures are recorded and after a threshold is reached,
 the circuit will "trip", setting the circuit into an "open" state.
 In an "open" state, every call to the service will fail by raising
 CircuitBrokenException.
 The circuit will remain in an "open" state until the failure timeout has
 elapsed.
 After the failure_timeout has elapsed, the circuit will go into
 a "half open" state and the call will go through.  A failure will
 immediately pop the circuit open again, and a success will close the
 circuit and reset the failure count.
     require 'circuit_breaker'
     class TestService
       include CircuitBreaker
       def call_remote_service() ...
       circuit_method :call_remote_service
       # Optional
       circuit_handler do |handler|
         handler.logger = Logger.new(STDOUT)
         handler.failure_threshold = 5
         handler.failure_timeout = 5
       end
       # Optional
       circuit_handler_class MyCustomCircuitHandler
     end
    Total
Ranking: 6,414 of 187,548
          Downloads: 754,404
        Daily
Ranking: 6,222 of 187,532
          Downloads: 398
        Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
| Rank | Downloads | Name | 
|---|---|---|
| 26,492 | 52,012 | px-service-client | 
Owners
| # | Gravatar | Handle | 
|---|---|---|
| 1 | wsargent | 
 xmisao
xmisao