-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fail_max value is not honored #13
Comments
Hi! Apologies for the late reply, I've been away recently. Hope you're doing well. When This functionality can be verified from the tests: https://github.com/arlyon/aiobreaker/blob/master/test/test_circuit.py |
Hi, thanks for the reply. From what I see here: https://github.com/arlyon/aiobreaker/blob/master/test/test_circuit.py#L81 There is a circuit breaker initialized with fail_max=3 and the DummyException is raised only 2 times which is not what expected, |
Ah, yes, I agree the wording is a bit complicated here. aiobreaker/aiobreaker/state.py Line 176 in 9b8ac0e
If you look here, the closed state listens for failed calls and raises a circuit breaker error. So, if max_fail is 3, the function is in fact called 3 times, however rather than raising the underlying error on the 3rd failure, a breaker exception is raised. I agree that this is potentially confusing. To make this behaviour clear in the tests I will adjust the test to assert the number of calls on |
Hi @arlyon
I am currently adding circuit breaker in the rest api client I am working on,
From my followin test, the fail_max value sounds wrong to me.
https://github.com/mardiros/blacksmith/blob/master/tests/unittests/test_middleware.py#L206-220
When I say fail_max=2, I am expecting to do 2 called before the circuit breaker is open, not (fail_max=1)
Could you confirm ?
The text was updated successfully, but these errors were encountered: