Only start task if existing one is done (#337)

This commit is contained in:
Alex Yao 2022-12-13 00:18:35 -06:00 committed by GitHub
parent 6d4b9df969
commit 3e99cd3177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: