Skip to content

Request: Expose is_disconnected() on Sender and Receiver #586

Open
@BruceBrown

Description

@BruceBrown

Currently, there's no way for a receiver to determine if it is disconnected, other than to try and receive something from the channel, which you don't always want to do. In my case, I want to check is_empty() and schedule a task if the receiver isn't empty. However, is_empty(), returns true if the queue is empty and it has been disconnected, leaving me with a dangling channel that doesn't get cleaned up. I don't think having is_empty() return false for a disconnected channel works, as that's going to make len() a bit odd. While I could use select, I've found that doesn't work so well, with 1000s of channels.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions