-
Notifications
You must be signed in to change notification settings - Fork 107
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
Simultaneous failures cause circuit to never move into the halfOpened state #385
Comments
Oops sorry about that I didn’t realise open() was the same thing that was called internally. I thought for the public api it would be strange for an open call to later be undone |
Another solution could be to check the state before calling |
Merged
lholmquist
pushed a commit
that referenced
this issue
Nov 8, 2019
fixes #385 by changing the behaviour of open() back to being a noop if the state is already open
Just released this as 4.2.1 |
This was referenced Apr 7, 2020
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Node.js Version:
10.17.0
Operating System:
MacOS 10.14.6
Steps to Produce Error:
I'm seeing an issue that started happening in
4.2.0
(#383) where the circuit never enters thehalfOpened
state.If you have a circuit that automatically opens after 5 requests and you concurrently launch 6 simultaneous requests that each eventually error:
fail()
but not callopen()
open()
which will emit theopen
event and start the timer to later move into thehalfOpened
stateopen()
again which will cancel the timer, but since it is already in theopened
state, will not emit theopen
event and thus not restart the timer.opened
state and never enters thehalfOpened
state, so all further requests are rejected.I think that the correct behavior might be for
open()
to cancel the current timer and immediately re-add it, so that it pushes the timer end date out regardless of whether or not the state change happens?The text was updated successfully, but these errors were encountered: