mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Run more of hassio setup in in tasks (#112151)
* Run more of hassio setup in in tasks There were a few more places were we waited in sequence where we have to make remote api calls that could be moved to tasks * tweak * tweak
This commit is contained in:
parent
a049d0e846
commit
d7507fd8a3
@ -375,6 +375,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
hass.bus.async_listen(EVENT_CORE_CONFIG_UPDATE, push_config)
|
hass.bus.async_listen(EVENT_CORE_CONFIG_UPDATE, push_config)
|
||||||
|
|
||||||
push_config_task = hass.async_create_task(push_config(None), eager_start=True)
|
push_config_task = hass.async_create_task(push_config(None), eager_start=True)
|
||||||
|
# Start listening for problems with supervisor and making issues
|
||||||
|
hass.data[DATA_KEY_SUPERVISOR_ISSUES] = issues = SupervisorIssues(hass, hassio)
|
||||||
|
issues_task = hass.async_create_task(issues.setup(), eager_start=True)
|
||||||
|
|
||||||
async def async_service_handler(service: ServiceCall) -> None:
|
async def async_service_handler(service: ServiceCall) -> None:
|
||||||
"""Handle service calls for Hass.io."""
|
"""Handle service calls for Hass.io."""
|
||||||
@ -435,8 +438,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Fetch data
|
# Fetch data
|
||||||
await update_info_data()
|
update_info_task = hass.async_create_task(update_info_data(), eager_start=True)
|
||||||
await push_config_task
|
|
||||||
|
|
||||||
async def _async_stop(hass: HomeAssistant, restart: bool) -> None:
|
async def _async_stop(hass: HomeAssistant, restart: bool) -> None:
|
||||||
"""Stop or restart home assistant."""
|
"""Stop or restart home assistant."""
|
||||||
@ -459,7 +461,18 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
async_setup_ingress_view(hass, host)
|
async_setup_ingress_view(hass, host)
|
||||||
|
|
||||||
# Init add-on ingress panels
|
# Init add-on ingress panels
|
||||||
await async_setup_addon_panel(hass, hassio)
|
panels_task = hass.async_create_task(
|
||||||
|
async_setup_addon_panel(hass, hassio), eager_start=True
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make sure to await the update_info task before
|
||||||
|
# _async_setup_hardware_integration is called
|
||||||
|
# so the hardware integration can be set up
|
||||||
|
# and does not fallback to calling later
|
||||||
|
await panels_task
|
||||||
|
await update_info_task
|
||||||
|
await push_config_task
|
||||||
|
await issues_task
|
||||||
|
|
||||||
# Setup hardware integration for the detected board type
|
# Setup hardware integration for the detected board type
|
||||||
@callback
|
@callback
|
||||||
@ -480,7 +493,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.flow.async_init(
|
hass.config_entries.flow.async_init(
|
||||||
hw_integration, context={"source": "system"}
|
hw_integration, context={"source": "system"}
|
||||||
)
|
),
|
||||||
|
eager_start=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
async_setup_hardware_integration_job = HassJob(
|
async_setup_hardware_integration_job = HassJob(
|
||||||
@ -494,10 +508,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
eager_start=True,
|
eager_start=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Start listening for problems with supervisor and making issues
|
|
||||||
hass.data[DATA_KEY_SUPERVISOR_ISSUES] = issues = SupervisorIssues(hass, hassio)
|
|
||||||
await issues.setup()
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user