client: Only wait for the task to be canceled if it's started.

This commit is contained in:
Damir Jelić 2019-04-17 13:31:55 +02:00
parent 827549ab7c
commit 42fc14ee35

View File

@ -104,7 +104,7 @@ class PanClient(AsyncClient):
async def loop_stop(self):
"""Stop the client loop."""
if not self.task:
if not self.task or self.task.done():
return
self.task.cancel()