-
Notifications
You must be signed in to change notification settings - Fork 603
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
Add Channel#closeWithElement
#3280
Add Channel#closeWithElement
#3280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More name ideas: sendThenClose
or sendLast
.
I think sendAndClose would be pretty clear for the user. |
…thpeti/fs2 into feature/add-channel-sendclose
I've been trying to figure out the correct semantics for this operation, which I think depends on expected use case, because as it stands, sending is not atomic with closing with this implementation. |
If I understand the use case correctly, I think the correct behaviour for this operation is to be called |
Thanks. That sounds right to me, @tothpeti wdyt? |
Sounds good to me, as well. |
case obtained @ ((Right(()), Left(Channel.Closed)), List(1)) => | ||
assertEquals(obtained, expectedSecondCase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't think this case should ever happen? Is it happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is happening once or twice during 10000 runs, but it is pretty rare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how that can happen if everything is working correctly. If the closeWithElement
returns that the Channel
is already closed, then who is closing it? Seems like a bug 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I left this match case there, when we iterated over multiple possible solutions. So, probably this will not happen. I will try it without this match case soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I tried with 100000 runs, and that match case never occurred. So, it can be safely removed. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for all your work on this!
This PR adds the requested functionality: #3279
closeWithElement
inChannel