Reputation: 3
I use hystrix(1.5.18) set ErrorThresholdPercentage
equals 30, when the error percentage over the threshold, circuitBreak
is open.
But, when an ahead request is return success, it will call marksuccess
method to set circuitBreak
false.
It is like a loop to switch the circuitBreak
status.
Is this a bug in hystrix?
.withCircuitBreakerErrorThresholdPercentage(30)
.withCircuitBreakerSleepWindowInMilliseconds(2000)
I expect consumer will try request after 2000ms, but not soon after one ahead request is return success
Upvotes: 0
Views: 169
Reputation: 5589
Probably you misunderstand the meaning of the property circuitBreaker.sleepWindowInMilliseconds
.
If the circuit is opened, all your requests will be rejected during sleepWindowInMilliseconds
. After sleepWindowInMilliseconds
milliseconds elapse, it will become half-open
state. In this state, only one request will be allowed and if it succeeds, the circuit will be closed again.
I guess that you saw the situation that your request was successful in half-open
state and it closed the circuit.
The below diagram from the official wiki could help you understand.
Upvotes: 0