-
Couldn't load subscription status.
- Fork 5
Streaming: Make events optional #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR makes events optional in the streaming functionality, allowing receivers to be created with or without stream status events. Key changes include:
- Updating test cases to parameterize the inclusion of events.
- Adding overloads and modifying the new_receiver implementation to support an include_events flag.
- Adjusting channel handling and closure logic to separately manage data and event channels.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/streaming/test_grpc_stream_broadcaster.py | Updated tests to handle optional stream events via parameterization. |
| src/frequenz/client/base/streaming.py | Modified the GrpcStreamBroadcaster API to support an include_events flag with corresponding channel and overload changes. |
| try: | ||
| await self._task | ||
| except asyncio.CancelledError: | ||
| pass |
Copilot
AI
Jun 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for closing the data and event channels is duplicated in both the stop and _run methods. Consider refactoring this duplicate code into a helper function to reduce repetition and improve maintainability.
| pass | |
| pass | |
| await self._close_channels() | |
| """Close the data and event channels.""" |
Signed-off-by: Mathias L. Baumann <[email protected]>
| maxsize: int = 50, | ||
| warn_on_overflow: bool = True, | ||
| *, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really part of this PR, but since you are adding the * here it makes me think that we should probably put all other arguments as keyword-only, as it can't be really inferred what they are by the type.
- **Make all parameters of streamers `new_receiver` named** #154 (comment)
No description provided.