aioharmony icon indicating copy to clipboard operation
aioharmony copied to clipboard

Fix minor asyncio usage issues

Open bdraco opened this issue 11 months ago • 0 comments

fixes https://github.com/home-assistant/core/issues/50492

  • with async_timeout is deprecated without async
  • there was one place where ensure_future/create_task did not hold a strong reference to tasks. see https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task

Important Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done. For reliable “fire-and-forget” background tasks, gather them in a collection:

bdraco avatar Aug 03 '23 03:08 bdraco