danielfm / pybreaker

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

Re-initialize state on Redis if missing #25

Closed scascketta closed 6 years ago

scascketta commented 7 years ago

Hi! I was testing how pybreaker would behave in various scenarios where state is being stored on Redis and the Redis server misbehaves. CircuitRedisStorage will handle intermittent and complete connection loss with the Redis server in an acceptable manner. But it doesn't handle data loss on the Redis server gracefully (it always expects to find the state on Redis).

This change modifies the state property so that if it appears that state on Redis was lost, it will try to setup the state on Redis again with the initial circuit breaker state.

danielfm commented 6 years ago

Thanks!