Closed squarejaw closed 8 years ago
Yup that seems wrong - I will see if I can take a look into this weekend. Thanks for the test code as well.
It looks like there is possibly a mistake in the logic between < 3.2.2 and the 3.2.2 version, I am trying to track it down. What it really looks like is an errant-ly written unit test that is attempting to validate something that may not make any sense (but somehow made sense at the time I wrote it). I am going to continue to look at it to make sure I didn't mean to do something else (swap the memory back in while I was writing it).
Fixing the case you outline causes this test - testHalfClosedWithLiveAttemptThrowsCBException to fail.
Is this causing you serious problems right now? I will try to dig to the bottom as fast as I can.
I'm not personally using the library in any major capacity, I've just been doing a survey of the landscape of available circuit breaker/resiliency libraries and testing a few out when I noticed this issue. In any case, I can always work with version 3.1.1 if necessary. Thanks for looking into this!
I pushed a fix for this into the code a little while ago - lemme know if this gets you back to what you expect. I couldn't find out why beyond me being totally silly that the thing in there made sense. A HALF CLOSED breaker should RE OPEN if error, should close on Success, which I believe that the unit tests now also prove.
I pulled down the project, built the jars, and reran the test code. Looks like it's working as expected now. Thanks for looking into this! :+1:
Given the following test code:
I get this result in the current version (3.2.2)
But I get this in the older version (3.1.1):
I was under the impression that the HALF_CLOSED (or DEGRADED) status would allow a single call to go through, but it appears to always be throwing a
CircuitBreakerException
before the call is made. Is there something I'm missing in order to get aCircuitBreaker
in a HALF_CLOSED state to re-attempt a call?