Avoid tracking import executor jobs (#114453)

This commit is contained in:
J. Nick Koston 2024-03-29 11:18:21 -10:00 committed by GitHub
parent 3b4958d972
commit 969b027a46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -783,11 +783,11 @@ class HomeAssistant:
def async_add_import_executor_job(
self, target: Callable[[*_Ts], _T], *args: *_Ts
) -> asyncio.Future[_T]:
"""Add an import executor job from within the event loop."""
task = self.loop.run_in_executor(self.import_executor, target, *args)
self._tasks.add(task)
task.add_done_callback(self._tasks.remove)
return task
"""Add an import executor job from within the event loop.
The future returned from this method must be awaited in the event loop.
"""
return self.loop.run_in_executor(self.import_executor, target, *args)
@overload
@callback