Skip to content

Commit eb31a09

Browse files
committed
Deprecate the OptionalReceiver
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 25ebf75 commit eb31a09

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

RELEASE_NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313
- An experimental `NopReceiver` implementation has been added, which can be used as a place-holder receiver that never receives a message.
1414

15+
- The experimental `OptionalReceiver` has been deprecated. It will be removed with the next major release. It can be replaced with a `NopReceiver` as follows:
16+
17+
```python
18+
opt_recv: Receiver[T] | None
19+
recv: Receiver[T] = NopReceiver[T]() if opt_recv is None else opt_recv
20+
```
21+
1522
## Bug Fixes
1623

1724
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->

src/frequenz/channels/experimental/_optional_receiver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111
import asyncio
1212

13-
from typing_extensions import override
13+
from typing_extensions import deprecated, override
1414

1515
from frequenz.channels import Receiver, ReceiverError, ReceiverMessageT_co
1616

1717

18+
@deprecated("Use `frequenz.channels.experimental.NopReceiver` instead.")
1819
class OptionalReceiver(Receiver[ReceiverMessageT_co]):
1920
"""A receiver that will wait indefinitely if there is no underlying receiver.
2021

0 commit comments

Comments
 (0)