Load network storage in a task to reduce startup time (#112460)

We waited for these in series but they are not dependant on
each other
This commit is contained in:
J. Nick Koston 2024-03-05 16:32:23 -10:00 committed by GitHub
parent 9be4fb0574
commit 2c13a81086
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ from typing import Any
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.singleton import singleton from homeassistant.helpers.singleton import singleton
from homeassistant.helpers.storage import Store from homeassistant.helpers.storage import Store
from homeassistant.util.async_ import create_eager_task
from .const import ( from .const import (
ATTR_CONFIGURED_ADAPTERS, ATTR_CONFIGURED_ADAPTERS,
@ -50,8 +51,9 @@ class Network:
async def async_setup(self) -> None: async def async_setup(self) -> None:
"""Set up the network config.""" """Set up the network config."""
await self.async_load() storage_load_task = create_eager_task(self.async_load())
self.adapters = await async_load_adapters() self.adapters = await async_load_adapters()
await storage_load_task
@callback @callback
def async_configure(self) -> None: def async_configure(self) -> None: