danielfm / pybreaker

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

Do not reset fail count in CircuitBreaker creation #29

Closed jcwilson closed 7 years ago

jcwilson commented 7 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.