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

fix: don't throw if the promise got completed in the meanwhile #1580

Merged

Conversation

janory
Copy link
Contributor

@janory janory commented Feb 21, 2022

References #1578.

Switching failure to tryFailure, because it can happen that the promise gets completed in the meanwhile, in this case we shouldn't throw an exception.

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, one idea to take this further

@@ -172,7 +172,7 @@ private final class AkkaNettyGrpcClientGraphStage[I, O](
call = null
}
if (!matVal.isCompleted) {
matVal.failure(new AbruptStageTerminationException(this))
matVal.tryFailure(new AbruptStageTerminationException(this))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can remove the matVal.isCompleted check now, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. 🤔
Does it make sense to try if we know it's completed?

On the other hand removing the check would reduce the LOC, so I can do that if you want. 👍
Should I?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A matter of taste I suppose - let's leave it like this 👍

@raboof raboof merged commit 21b29da into akka:main Feb 21, 2022
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