-
Notifications
You must be signed in to change notification settings - Fork 477
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 {Sender, Receiver}::is_connected #497
Conversation
The CI failure seems unrelated. |
What is the use case for methods like this? They seem inherently problematic to use. At the very least, the docs on these methods should discuss this. |
The use case is I want to know before creating a message if the receiving end is still connected, if not I can avoid doing any work for a message that is never going to be received.
What do you see as problematic? Of course the method is inherently race-y as the moment the method returns |
Its raciness is exactly why I consider it problematic. I don't maintain this library, but I personally wouldn't accept a new API item like this without a reasonable benchmark. If we must have them, the docs should do their best to de-emphasize using this routine and explain their niche use case. |
What do you want to benchmark? If creating a message is expansive, then its always going to be faster to not create a message than creating it and the dropping it (after failing to send it). |
That sounds like a micro-benchmark to me. I'd prefer seeing something more holistic. |
Sorry @BurntSushi but I have no idea what you want from me... I asked what you want me to benchmark but you haven't really given an answer to that. |
@Thomasdezeeuw I'm not the maintainer of this library. I'm just saying what I personally would like to see because I personally find these APIs to be of somewhat dubious value. Which in turn, to me, means they should be really well motivated before adding them. Namely, I'd like to see a holistic example of a real use case where these sorts of APIs would help. I would probably expect some kind of latency/throughput figures with/without these APIs for example. It may be hard to provide this. |
@stjepang could you take a look at this? In #256 (comment) you mentioned this feature. |
I don't have a very strong opinion on whether to add this API at this time, but I think it's better to be |
@taiki-e I'm ok with changing it, but would that mean this would be considered to be merged? |
@Thomasdezeeuw I think documentation about what users should be notes of when using this API is needed to merge this PR, not only renaming. FYI: golang/go#20680 and golang/go#30906 have some specific explanations about the problems of similar features. |
This has taken too long and I've moved on to using a different crate. |
Checks if the other side of the channel is connected.
Updates #256 (comment)