mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Add storage helper and migrate config entries (#15045)
* Add storage helper * Migrate config entries to use the storage helper * Make sure tests do not do I/O * Lint * Add versions to stored data * Add more instance variables * Make migrator load config if nothing to migrate * Address comments
This commit is contained in:
@@ -230,6 +230,20 @@ class HomeAssistant(object):
|
||||
|
||||
return task
|
||||
|
||||
@callback
|
||||
def async_add_executor_job(
|
||||
self,
|
||||
target: Callable[..., Any],
|
||||
*args: Any) -> asyncio.tasks.Task:
|
||||
"""Add an executor job from within the event loop."""
|
||||
task = self.loop.run_in_executor(None, target, *args)
|
||||
|
||||
# If a task is scheduled
|
||||
if self._track_task:
|
||||
self._pending_tasks.append(task)
|
||||
|
||||
return task
|
||||
|
||||
@callback
|
||||
def async_track_tasks(self):
|
||||
"""Track tasks so you can wait for all tasks to be done."""
|
||||
|
||||
Reference in New Issue
Block a user