Open
Description
Hi,
Thanks a lot for your library, it's simple, yet powerful! :)
Could you please clarify one confusion I have about ErrTooManyRequests error? I don't quite understand from the code when this error could happen.
I see the if state == StateHalfOpen && cb.counts.Requests >= cb.maxRequests
condition in the beforeRequest()
method but from the rest of the code it doesn't look like it could ever be met. This is because we either get enough consecutive requests to trip circuit to close with this condition if cb.counts.ConsecutiveSuccesses >= cb.maxRequests { cb.setState(StateClosed, now) }
or we go back to open state because of a single failure in onFailure()
. Or did I misunderstand something?
Metadata
Assignees
Labels
No labels
Activity