diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e19c87d6..e68943c2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,13 +2,19 @@ ## Summary - +This release removes what v1.13.0 deprecated, and it has breaking changes that v1.13.0 can't warn about, mostly in `BroadcastChannel`. Read the Upgrading section before upgrading. The main breaking changes are: -## Upgrading +- A `BroadcastChannel` no longer closes when a message is sent while it has no receivers. `send()` raises the new `SenderHasNoReceiversError` instead, and the channel stays open, so code that relied on the channel closing has to catch the error. +- `BroadcastChannel()` takes `resend_latest` only by keyword, `BroadcastSender.subscribe()` uses the channel's `buffer_size` and `warn_on_overflow` as defaults, and `BroadcastSender.clone()` raises a `SenderClosedError` on a closed sender. +- `Receiver.close()` is abstract, so custom receivers have to implement it. + +The new `frequenz.channels.Pipe` is a separate implementation that replaces `frequenz.channels.experimental.Pipe`, which is deprecated but still behaves as in v1. The new `Pipe` closes its sender, and by default its receiver too, in cases where the experimental one leaves them open, so check how your code shuts down before switching. + +To upgrade, move to v1.13.0 first and fix all its deprecation warnings: every replacement already exists there, so a project can then require `frequenz-channels >= 1.13.0, < 3`. Then check the changes above, which can make the same code behave differently on v2. `Broadcast` still works, but stays deprecated. - +## Upgrading -- `BroadcastChannel()` and `BroadcastSender.subscribe()` now take everything but the name by keyword: `resend_latest`, `buffer_size` and `warn_on_overflow`. A call that passed any of them by position fails with a `TypeError`. Pass them by keyword, as v1.13.0 recommends. +- `BroadcastChannel()` and `BroadcastSender.subscribe()` now take only the name by position. `resend_latest` (only in `BroadcastChannel()`), `buffer_size` and `warn_on_overflow` must be passed by keyword. A call that passes any of them by position fails with a `TypeError`. v1.13.0 already deprecates passing `warn_on_overflow` by position, but it doesn't warn about `resend_latest`, so look for calls like `BroadcastChannel("name", True)` and pass it by keyword. - The deprecated `limit` argument of `BroadcastChannel()` and `BroadcastSender.subscribe()` is removed. Use `buffer_size` instead, which exists since v1.13.0, so you can migrate before upgrading. `Broadcast.new_receiver()` still takes `limit`. @@ -40,7 +46,7 @@ - With `close_pipe_on_send_error=False`, the new `Pipe` also drops the message that failed with any other `SenderError` and keeps forwarding the next ones. This doesn't bring back the behavior of the experimental one. - `stop()` leaves both ends open in both. -- `BroadcastSender.clone()` now raises a `SenderClosedError` if the sender is closed, and a `SenderError` if the channel is closed, like `send()` and `subscribe()` do. Clone a sender before closing it, or catch `SenderError`. +- `BroadcastSender.clone()` now raises a `SenderClosedError` if the sender is closed, like `send()` and `subscribe()` do. Clone a sender before closing it, or catch `SenderClosedError`. A `Broadcast` can also be closed with `aclose()` while it still has open senders; after that, cloning any of them raises a `SenderError`. - `BroadcastSender.subscribe()` now uses the `buffer_size` and `warn_on_overflow` values the `BroadcastChannel` was created with as defaults, instead of `50` and `True`. Pass `buffer_size=50, warn_on_overflow=True` to keep the old values. @@ -50,8 +56,6 @@ ## New Features - - - `TransientSenderError` is a new `SenderError` for errors after which the sender and its channel can still be used: only the message that failed wasn't sent. Catch it before `SenderError` to tell it apart from the errors that make a sender unusable. - `SenderHasNoReceiversError` is a new `TransientSenderError`. An open sender of a `BroadcastChannel`, or of a `Broadcast` created with `auto_close=True`, raises it from `send()` while the channel is open but has no receivers. The message is dropped, but with `resend_latest=True`, new receivers still get it if it is the last message sent and it isn't `None`. The channel stays open, so sending works again once a receiver subscribes. @@ -62,8 +66,6 @@ ## Bug Fixes - - - Closing a broadcast receiver now wakes up tasks waiting for messages on it, instead of leaving them blocked until the next message arrived or the channel was closed. - Closing a broadcast receiver now drops the messages left in its buffer, so it is no longer reported as ready. So `select()` no longer reports it as stopped over and over, and no longer fails with a `SelectError` for a `filter()` on it.