diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4bd60ba..2117a1b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,7 +10,7 @@ ## New Features - +* Add the `warn_on_overflow` option to the streaming receivers to allow ignoring overflow warnings ## Bug Fixes diff --git a/pyproject.toml b/pyproject.toml index 0512c7f..5b91562 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] requires-python = ">= 3.11, < 4" dependencies = [ - "frequenz-channels >= v1.0.0-rc1, < 2", + "frequenz-channels >= 1.6.1, < 2", "grpcio >= 1.54.2, < 2", "protobuf >= 4.21.6, < 6", "typing-extensions >= 4.5.0, < 5", diff --git a/src/frequenz/client/base/streaming.py b/src/frequenz/client/base/streaming.py index baa58ee..a6134d8 100644 --- a/src/frequenz/client/base/streaming.py +++ b/src/frequenz/client/base/streaming.py @@ -60,16 +60,22 @@ def __init__( # pylint: disable=too-many-arguments,too-many-positional-argument ) self._task = asyncio.create_task(self._run()) - def new_receiver(self, maxsize: int = 50) -> channels.Receiver[OutputT]: + def new_receiver( + self, maxsize: int = 50, warn_on_overflow: bool = True + ) -> channels.Receiver[OutputT]: """Create a new receiver for the stream. Args: maxsize: The maximum number of messages to buffer. + warn_on_overflow: Whether to log a warning when the receiver's + buffer is full and a message is dropped. Returns: A new receiver. """ - return self._channel.new_receiver(limit=maxsize) + return self._channel.new_receiver( + limit=maxsize, warn_on_overflow=warn_on_overflow + ) @property def is_running(self) -> bool: