From f762f35f90061519da422f77cae9fa63e47e67e0 Mon Sep 17 00:00:00 2001 From: camille-bouvy-frequenz Date: Wed, 19 Feb 2025 12:12:03 +0100 Subject: [PATCH 1/2] Add the warn_on_overflow option the the streaming receivers Signed-off-by: camille-bouvy-frequenz --- pyproject.toml | 2 +- src/frequenz/client/base/streaming.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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: From 7043b4fba084508237f68504deb56f2add8fedf7 Mon Sep 17 00:00:00 2001 From: camille-bouvy-frequenz Date: Wed, 19 Feb 2025 12:14:12 +0100 Subject: [PATCH 2/2] Update release notes Signed-off-by: camille-bouvy-frequenz --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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