Make the frontend available sooner (Part 1 of 2) (#36263)
* 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) * Address review comments * bump timeout to 1800s, adjust comment * bump timeout to 4h * remove timeout failsafe * and the test
This commit is contained in:
1 parent
7338feb659
commit
578d4a9b6a
13 files changed
+126
-62
No files matched your search
@@ -1,4 +1,5 @@
|
||||
"""Decorators for the Websocket API."""
|
||||
import asyncio
|
||||
from functools import wraps
|
||||
import logging
|
||||
from typing import Awaitable, Callable
|
||||
@@ -31,7 +32,9 @@ def async_response(
|
||||
@wraps(func)
|
||||
def schedule_handler(hass, connection, msg):
|
||||
"""Schedule the handler."""
|
||||
hass.async_create_task(_handle_async_response(func, hass, connection, msg))
|
||||
# As the webserver is now started before the start
|
||||
# event we do not want to block for websocket responders
|
||||
asyncio.create_task(_handle_async_response(func, hass, connection, msg))
|
||||
|
||||
return schedule_handler
|
||||
|
||||
|
||||
@@ -165,7 +165,9 @@ class WebSocketHandler:
|
||||
EVENT_HOMEASSISTANT_STOP, handle_hass_stop
|
||||
)
|
||||
|
||||
self._writer_task = self.hass.async_create_task(self._writer())
|
||||
# As the webserver is now started before the start
|
||||
# event we do not want to block for websocket responses
|
||||
self._writer_task = asyncio.create_task(self._writer())
|
||||
|
||||
auth = AuthPhase(self._logger, self.hass, self._send_message, request)
|
||||
connection = None
|
||||
|
||||
Reference in new issue
Block a user