From 3e99cd31773db89bc53a331ad37dcffffe483104 Mon Sep 17 00:00:00 2001 From: Alex Yao <33379584+alexyao2015@users.noreply.github.com> Date: Tue, 13 Dec 2022 00:18:35 -0600 Subject: [PATCH] Only start task if existing one is done (#337) --- aioesphomeapi/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioesphomeapi/connection.py b/aioesphomeapi/connection.py index 16a8a22..4170a4f 100644 --- a/aioesphomeapi/connection.py +++ b/aioesphomeapi/connection.py @@ -151,7 +151,7 @@ class APIConnection: # themself, effectively ending execution after _cleanup which may be unexpected self._ping_stop_event.set() - if not self._cleanup_task or not self._cleanup_task.done(): + if not self._cleanup_task or self._cleanup_task.done(): self._cleanup_task = asyncio.create_task(_do_cleanup()) async def _connect_resolve_host(self) -> hr.AddrInfo: