Skip to content
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

Wrapped function is called twice during successful call in open state #8

Merged
merged 1 commit into from
Jan 25, 2017

Conversation

jstordeur
Copy link

When the circuit breaker is open:
cb.call() delegates to CircuitOpenState.call() which is not implemented so the parent CircuitBreakerState.call() is called.
This function calls CircuitOpenState.before_call() and then call the wrapped function.

CircuitOpenState.before_call() switch the state of the CB to half open and then calls cb.call(), which in turn delegates to CircuitHalfOpenState.call() which is not implemented so we go back to CircuitBreakerState.call() which eventually calls the wrapped function a second time (from a timeline perspective this is actually the first call)

I updated a testcase to illustrate the issue and propose a solution.

@danielfm
Copy link
Owner

Nice catch! Thanks! 😄

@danielfm danielfm merged commit 5b7b2ab into danielfm:master Jan 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants