Combine recorder and frontend bootstrap step (#113985)

This commit is contained in:
J. Nick Koston
2024-03-22 13:50:39 -10:00
committed by GitHub
parent bf8d880e5f
commit 952f47ab18
7 changed files with 34 additions and 21 deletions

View File

@@ -194,16 +194,14 @@ CRITICAL_INTEGRATIONS = {
"frontend",
}
SETUP_ORDER = {
SETUP_ORDER = (
# Load logging as soon as possible
"logging": LOGGING_INTEGRATIONS,
# Setup frontend
"frontend": FRONTEND_INTEGRATIONS,
# Setup recorder
"recorder": RECORDER_INTEGRATIONS,
("logging", LOGGING_INTEGRATIONS),
# Setup frontend and recorder
("frontend, recorder", {*FRONTEND_INTEGRATIONS, *RECORDER_INTEGRATIONS}),
# Start up debuggers. Start these first in case they want to wait.
"debugger": DEBUGGER_INTEGRATIONS,
}
("debugger", DEBUGGER_INTEGRATIONS),
)
async def async_setup_hass(
@@ -856,10 +854,9 @@ async def _async_set_up_integrations(
if "recorder" in domains_to_setup:
recorder.async_initialize_recorder(hass)
pre_stage_domains: dict[str, set[str]] = {
name: domains_to_setup & domain_group
for name, domain_group in SETUP_ORDER.items()
}
pre_stage_domains = [
(name, domains_to_setup & domain_group) for name, domain_group in SETUP_ORDER
]
# calculate what components to setup in what stage
stage_1_domains: set[str] = set()
@@ -885,7 +882,7 @@ async def _async_set_up_integrations(
stage_2_domains = domains_to_setup - stage_1_domains
for name, domain_group in pre_stage_domains.items():
for name, domain_group in pre_stage_domains:
if domain_group:
stage_2_domains -= domain_group
_LOGGER.info("Setting up %s: %s", name, domain_group)