Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Circuit-breakers count all faults they handle as an aggregate, not separately #490
I have a policy wrap with WaitAndRetry and CircuitBreaker policies, so, from my understanding the circuit only breaks when the exception is the same consecutively.
I don't know if I'm misunderstanding the usage or I have something wrong with the policies.
changed the title from
Issue with CircuitBreaker policy
Circuit-breakers count all faults they handle as an aggregate, not separately
Jul 20, 2018
The circuit-breaker will break after N consecutive actions executed through the policy have thrown 'a' handled exception - any of the exceptions handled by the policy. This is intentional behaviour.
The documentation here used to say 'a' handled exception: I've just updated it to say 'any' handled exception, to make that clearer. Thanks for the question.
If you wanted to construct a system that counts different faults (or groups of faults) separately for the purposes of circuit-breaking, you could achieve that by defining separate circuit-breaker policy instances for each fault (or group of faults) you wanted counted separately, and then nesting those circuit-breakers in a PolicyWrap.