Fix dangling task for mysensors (#88290)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Paulus Schoutsen 2023-02-17 14:52:30 -05:00 committed by GitHub
parent 5a31bb2ff3
commit 517e88600c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,7 +116,7 @@ async def try_connect(
finally:
if connect_task is not None and not connect_task.done():
connect_task.cancel()
asyncio.create_task(gateway.stop())
await gateway.stop()
except OSError as err:
_LOGGER.info("Try gateway connect failed with exception", exc_info=err)
return False