Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import annotations

import asyncio
from collections.abc import Coroutine
import contextlib
from datetime import timedelta
import logging
Expand Down Expand Up @@ -51,6 +50,7 @@
async_set_domains_to_be_loaded,
async_setup_component,
)
from .util.async_ import create_eager_task
from .util.logging import async_activate_log_queue_handler
from .util.package import async_get_user_site, is_virtual_env

Expand Down Expand Up @@ -665,7 +665,7 @@ async def _async_resolve_domains_to_setup(
to_get = old_to_resolve

manifest_deps: set[str] = set()
resolve_dependencies_tasks: list[Coroutine[Any, Any, bool]] = []
resolve_dependencies_tasks: list[asyncio.Task[bool]] = []
integrations_to_process: list[loader.Integration] = []

for domain, itg in (await loader.async_get_integrations(hass, to_get)).items():
Expand All @@ -677,7 +677,13 @@ async def _async_resolve_domains_to_setup(
manifest_deps.update(itg.after_dependencies)
needed_requirements.update(itg.requirements)
if not itg.all_dependencies_resolved:
resolve_dependencies_tasks.append(itg.resolve_dependencies())
resolve_dependencies_tasks.append(
create_eager_task(
itg.resolve_dependencies(),
name=f"resolve dependencies {domain}",
loop=hass.loop,
)
)

if unseen_deps := manifest_deps - integration_cache.keys():
# If there are dependencies, try to preload all
Expand Down Expand Up @@ -710,6 +716,7 @@ async def _async_resolve_domains_to_setup(
hass.async_create_background_task(
requirements.async_load_installed_versions(hass, needed_requirements),
"check installed requirements",
eager_start=True,
)
# Start loading translations for all integrations we are going to set up
# in the background so they are ready when we need them. This avoids a
Expand All @@ -724,6 +731,7 @@ async def _async_resolve_domains_to_setup(
hass.async_create_background_task(
translation.async_load_integrations(hass, {*BASE_PLATFORMS, *domains_to_setup}),
"load translations",
eager_start=True,
)

return domains_to_setup, integration_cache
Expand Down