Skip to content

Commit f3fc397

Browse files
authored
Make actor example loop forever (#1029)
Fixes #1001.
2 parents 8b93da9 + 6bf8e4b commit f3fc397

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/frequenz/sdk/actor/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class communicates through message passing. Even when no particular message pass
4949
5050
## Lifecycle
5151
52+
5253
Actors are not started when they are created. There are 3 main ways to start an actor
5354
(from most to least recommended):
5455
@@ -80,7 +81,9 @@ class communicates through message passing. Even when no particular message pass
8081
8182
class MyActor(Actor):
8283
async def _run(self) -> None:
83-
print("Hello World!")
84+
while True:
85+
print("Hello World!")
86+
await asyncio.sleep(1)
8487
8588
await run(MyActor()) # (1)!
8689
```

0 commit comments

Comments
 (0)