-
Notifications
You must be signed in to change notification settings - Fork 1k
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
CircuitBreaker's Open state should return a faulted Task instead of throwing #5117
Comments
Agree - do we need to break the existing API in order to do this? |
Not the API, but if someone is wrapping the calls to the CB in a try
{
ReceivePluginInternal(message);
_breaker.WithCircuitBreaker(() => DeleteAsync(saveSnapshotFailure.Metadata));
}
finally
{
senderPersistentActor.Tell(message);
} But I don't think the intent was to shield against any exception throwing in the CB but in the call to |
@Aaronontheweb any thoughts? |
Looks good to me - let's go for it. |
Sorry for the delay on getting back to you on this @ismaelhamed - this change looks safe. |
Version Information
Akka 1.4.21
Describe the bug
CircuitBreaker's
Open
andHalfOpen
states should return a faultedTask
with theOpenCircuitException
exception instead of throwing.To Reproduce
Expected behavior
Be able to handle the
OpenCircuitException
with just thePipeTo
, without needing to add anotherContinueWith
to the mix.Actual behavior
OpenCircuitException
cannot be handled in the failure callback, and the actor restarts due to the unhadled exception.Proposed fix
Return a faulted
Task
:...instead of throwing
The text was updated successfully, but these errors were encountered: