frequenz-floss / frequenz-channels-python

Channel implementations for Python
https://frequenz-floss.github.io/frequenz-channels-python/
MIT License
7 stars 8 forks source link

A way to explicitly stop a `Receiver` #297

Open Marenz opened 4 months ago

Marenz commented 4 months ago

If you stop reading from a channel, you will get an overflow warning message after a short while.

Sometimes, however we want to properly stop and not get spammed with log warnings, so a convenient and explicit way to do that would be nice.

llucax commented 4 months ago

There is usually a way to stop receiving data from a channel, by stopping the channel, but I think this issue is about stopping a single receiver, not shutting down a whole channel, so I updated the subject.

BTW, the logging of overflow only applies to Broadcast channels, Anycast doesn't have a per-receiver buffer so there are no warnings, at least at the receiver level.

In any case I think a stop() and a async context manager interface would be a good addition for Receiver in general.