Skip to content

Commit 47bef4a

Browse files
committed
Improve warning about holding a reference to Service
The warning is not very clear and might suggest users need to hold references to the service's tasks, which is not correct, only a reference to the service itself should be saved. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent b6ed4bd commit 47bef4a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/frequenz/core/asyncio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ class Service(abc.ABC):
101101
implementation does not collect any results and re-raises all exceptions.
102102
103103
Warning:
104-
As services manage [`asyncio.Task`][] objects, a reference to them must be held
105-
for as long as the service is expected to be running, otherwise its tasks will
106-
be cancelled and the service will stop. For more information, please refer to
107-
the [Python `asyncio`
104+
As services manage [`asyncio.Task`][] objects, a reference to a running service
105+
must be held for as long as the service is expected to be running. Otherwise, its
106+
tasks will be cancelled and the service will stop. For more information, please
107+
refer to the [Python `asyncio`
108108
documentation](https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task).
109109
110110
Example:

0 commit comments

Comments
 (0)