Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->
* Add the `warn_on_overflow` option to the streaming receivers to allow ignoring overflow warnings

## Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/frequenz/client/base/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading