Skip to content

Commit da4f56e

Browse files
committed
Add a note about why we use an async context manager
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 36bc923 commit da4f56e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/frequenz/sdk/actor/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ async def main() -> None: # (2)!
132132
[senders][frequenz.channels.Sender] and
133133
[receivers][frequenz.channels.Receiver] from the channels.
134134
135+
!!! note
136+
137+
We don't use the [`run()`][frequenz.sdk.actor.run] function here because we
138+
want to stop the actors when we are done with them, but the actors will run
139+
forever (as long as the channel is not closed). So the async context manager
140+
is a better fit for this example.
141+
135142
6. We schedule the [sending][frequenz.channels.Sender.send] of the message
136143
`Hello` to `Actor1` via `input_channel`.
137144

0 commit comments

Comments
 (0)