Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

https://github.com/etimberg/pycircuitbreaker/

A python implementation of the circuit breaker pattern. Not a new concept, but I did innovate in how the breaker decides to open.

I realized that with a normal breaker, if you set the threshold to 5, but 4/5 requests failed (say due to a backend service being partially down) the breaker would never open. To solve this, you can set the breaker to use the net error count so that the breaker would behave as such:

Req Num | Req Status | Breaker Status

1 | Fail | Closed

2 | Fail | Closed

3 | Fail | Closed

4 | Fail | Closed

5 | Pass | Closed

6 | Fail | Closed

7 | Fail | Open



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: