-
Notifications
You must be signed in to change notification settings - Fork 9
Implement a NopReceiver
#419
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
Signed-off-by: Sahas Subramanian <[email protected]>
Signed-off-by: Sahas Subramanian <[email protected]>
Signed-off-by: Sahas Subramanian <[email protected]>
Signed-off-by: Sahas Subramanian <[email protected]>
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 introduces a new experimental NopReceiver that acts as a place‐holder receiver, along with updates to tests and deprecation of OptionalReceiver.
- Updated tests across multiple modules to use asynchronous closing via aclose().
- Added a new experimental NopReceiver and its corresponding tests.
- Deprecated OptionalReceiver and updated the export order in the experimental module.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_merge_integration.py | Replaced synchronous close() calls with asynchronous aclose() calls in channel handling. |
| tests/test_broadcast.py | Updated broadcast channel closing to use aclose() consistently. |
| tests/test_anycast.py | Updated anycast channel closing to use aclose() consistently. |
| tests/experimental/test_nop_receiver.py | Added tests to verify the behavior of the new NopReceiver. |
| src/frequenz/channels/experimental/_optional_receiver.py | Deprecated OptionalReceiver with a recommendation to use NopReceiver instead. |
| src/frequenz/channels/experimental/_nop_receiver.py | Introduced the new NopReceiver implementation that never receives a message. |
| src/frequenz/channels/experimental/init.py | Updated the module exports to include NopReceiver and reposition WithPrevious for clarity. |
| RELEASE_NOTES.md | Documented the new NopReceiver feature and migration notes for OptionalReceiver deprecation. |
| from ._with_previous import WithPrevious | ||
|
|
||
| __all__ = [ | ||
| "NopReceiver", |
Copilot
AI
May 14, 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.
[nitpick] Consider sorting the all list alphabetically to improve readability and maintainability.
|
Can drop the deprecation commit, if you want to postpone it. |
|
|
||
| @override | ||
| async def ready(self) -> bool: | ||
| """Wait for ever unless the receiver is closed. |
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.
forever
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.
I know I suggested this name, but recently I needed something similar for a context manager and bumped into nullcontext, so maybe NullReceiver could be more familiar to python users.
But just an idea, I think the gain, if any, is marginal anyways...
It is useful as a place-holder receiver for use in contexts where a receiver is necessary, but one is not available.