mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Make the frontend available sooner (Part 2 of 2) (#36264)
* Part 1 of 2 (no breaking changes in part 1). When integrations configured via the UI block startup or fail to start, the webserver can remain offline which make it is impossible to recover without manually changing files in .storage since the UI is not available. This change is the foundation that part 2 will build on and enable a listener to start the webserver when the frontend is finished loading. Frontend Changes (home-assistant/frontend#6068) * Part 1 of 2 (no breaking changes in part 1). When integrations configured via the UI block startup or fail to start, the webserver can remain offline which make it is impossible to recover without manually changing files in .storage since the UI is not available. This change is the foundation that part 2 will build on and enable a listener to start the webserver when the frontend is finished loading. Frontend Changes (home-assistant/frontend#6068) * Part 2 of 2 (breaking changes in part 2). When integrations configured via the UI block startup or fail to start, the webserver can remain offline which make it is impossible to recover without manually changing files in .storage since the UI is not available. This change is the foundation that part 2 will build on and enable a listener to start the webserver when the frontend is finished loading. * bump timeout to 1800s, adjust comment * bump timeout to 1800s, adjust comment * bump timeout to 4h * bump timeout to 4h * remove timeout failsafe * remove timeout failsafe * and the test * and the test * find the test that needs mocking * find the test that needs mocking * Revert "find the test that needs mocking" This reverts commit 064e7787a8e9bc65df965530726fa1c41f8bcd36. * Revert "find the test that needs mocking" This reverts commit 064e7787a8e9bc65df965530726fa1c41f8bcd36. * fix the one that was missed due to the conflict
This commit is contained in:
parent
5cf93e3639
commit
00387bf870
@ -19,6 +19,7 @@ from homeassistant.core import Event, HomeAssistant
|
||||
from homeassistant.helpers import storage
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.loader import bind_hass
|
||||
from homeassistant.setup import ATTR_COMPONENT, EVENT_COMPONENT_LOADED
|
||||
import homeassistant.util as hass_util
|
||||
from homeassistant.util import ssl as ssl_util
|
||||
|
||||
@ -232,6 +233,17 @@ async def async_setup(hass, config):
|
||||
|
||||
await start_http_server_and_save_config(hass, dict(conf), server)
|
||||
|
||||
async def async_wait_frontend_load(event: Event) -> None:
|
||||
"""Wait for the frontend to load."""
|
||||
|
||||
if event.data[ATTR_COMPONENT] != "frontend":
|
||||
return
|
||||
|
||||
await start_server(event)
|
||||
|
||||
startup_listeners.append(
|
||||
hass.bus.async_listen(EVENT_COMPONENT_LOADED, async_wait_frontend_load)
|
||||
)
|
||||
startup_listeners.append(
|
||||
hass.bus.async_listen(EVENT_HOMEASSISTANT_START, start_server)
|
||||
)
|
||||
|
@ -316,6 +316,8 @@ async def test_setup_hass_takes_longer_than_log_slow_startup(
|
||||
), patch.object(bootstrap, "LOG_SLOW_STARTUP_INTERVAL", 0.3), patch(
|
||||
"homeassistant.components.frontend.async_setup",
|
||||
side_effect=_async_setup_that_blocks_startup,
|
||||
), patch(
|
||||
"homeassistant.components.http.start_http_server_and_save_config"
|
||||
):
|
||||
await bootstrap.async_setup_hass(
|
||||
config_dir=get_test_config_dir(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user