danielfm / pybreaker

Python implementation of the Circuit Breaker pattern.
BSD 3-Clause "New" or "Revised" License
512 stars 74 forks source link

Do not reset fail count in CircuitBreaker creation #29

Closed jcwilson closed 6 years ago

jcwilson commented 6 years ago

The current CircuitBreaker code currently correctly detects the current state from the provided state storage object and uses it to construct the internal state object. However when the detected state is "closed", the newly instantiated CircuitClosedState will reset the fail counter on the breaker.

These changes move the reset_counter() call into the notify block.

This issue was called out in #26, but was not addressed in #27.