-
Notifications
You must be signed in to change notification settings - Fork 9
Description
What's needed
Still need to come up with a new name for this broadcast channel configuration, but I think it would be nice to get broadcast channels that pause on overflowing receivers. (without blocking sender.send)
Receiver behaviour
When a receiver is not being consumed from for a certain duration, the channel stops sending to it. If the receiver is awaited again, it gets treated like a new receiver, starting with an empty buffer, and respecting resend_latest.
Sender behaviour
The send methods don't block, so it is the same behaviour as now, but the sender has a property and an async method which can be used to prevent wasteful work, like this:
if not sender.has_active_receivers:
await sender.wait_for_receivers()This would prevent the sending side from doing active work, and possibly stop receiving from its upstream and stop work on that level as well.
So channels would finally transmit information about receivers to the sending side, if they are interested.