Skip to content

Commit

Permalink
Explain the Receiver.close() method in the user guide
Browse files Browse the repository at this point in the history
Signed-off-by: Sahas Subramanian <[email protected]>
  • Loading branch information
shsms committed Jan 21, 2025
1 parent b27175a commit cd70b3a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/frequenz/channels/_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@
# If we get here, the receiver was stopped
```
# Closing receivers
To deal with situations where data from a particular stream is no-longer required,
receivers offer a [`close()`][frequenz.channels.Receiver.close] method that can be used
to stop it from receiving new messages.
After `close()` is called, we can still receive messages that are in the receiver's
buffer, but as soon as the receiver's buffer has been drained, trying to receive further
messages from a *closed* receiver will raise a
[`ReceiverStoppedError`][frequenz.channels.ReceiverStoppedError].
# Advanced Usage
!!! Warning inline end
Expand Down

0 comments on commit cd70b3a

Please sign in to comment.