Skip to content

Conversation

@Marenz
Copy link
Contributor

@Marenz Marenz commented Jun 4, 2025

No description provided.

Copilot AI review requested due to automatic review settings June 4, 2025 11:51
@Marenz Marenz requested a review from a team as a code owner June 4, 2025 11:51
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:code Affects the code in general labels Jun 4, 2025
Copy link

Copilot AI left a 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
Copy link

Copilot AI Jun 4, 2025

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.

Suggested change
pass
pass
await self._close_channels()
"""Close the data and event channels."""

Copilot uses AI. Check for mistakes.
@Marenz Marenz force-pushed the optional_events branch from 28bf7d0 to 81b1e26 Compare June 4, 2025 11:54
@github-actions github-actions bot added the part:docs Affects the documentation label Jun 4, 2025
@Marenz Marenz force-pushed the optional_events branch from 81b1e26 to d82ac38 Compare June 4, 2025 11:58
Signed-off-by: Mathias L. Baumann <[email protected]>
@Marenz Marenz force-pushed the optional_events branch from d82ac38 to e0216ea Compare June 4, 2025 11:59
@Marenz Marenz requested a review from llucax June 4, 2025 12:00
Comment on lines +214 to +216
maxsize: int = 50,
warn_on_overflow: bool = True,
*,
Copy link
Contributor

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.

@Marenz Marenz added this pull request to the merge queue Jun 4, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit c2c6138 Jun 4, 2025
5 checks passed
@Marenz Marenz deleted the optional_events branch June 4, 2025 15:27
github-merge-queue bot pushed a commit that referenced this pull request Jun 5, 2025
- **Make all parameters of streamers `new_receiver` named**

#154 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:code Affects the code in general part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants