-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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::len
to mpsc channel
#6314
Comments
Adding a |
The |
You should probably add a method here, and use it to provide a len method on the |
Actually, I think simply |
Hmm, there's no equivalent to that for the unbounded channel, so I am still okay with adding a |
I don't understand why this issue was closed since it explicitly requests a len() method on mpsc::Sender and references crossbeam::channel::Sender::len(). The merged PR #6348 adds methods to the receiver not the sender. The lack of a sender len method is presently causing me difficulties as I attempt to migrate from another crates's channel impl. I was hoping to remove a dep, but may not be able to until this is implemented. request reopen. |
Sender::len
to mpsc channel
I suppose that is fair enough. That said, it's probably somewhat tricky to implement. You need information from fields that are currently only accessible to the receiver. |
I'm usually choosing channel sizes intuitively. I frequently miss having empirical data on how full the channels in my system are during normal operation or more exotic load situations.
I'd like to either have public functions on the
mpsc::Sender
that allow me to see how many elements are in there, like crossbeam::channel::Sender::len.It would also be fine to emit the channel length as a metric of sorts, like attempted in this PR.
The text was updated successfully, but these errors were encountered: