Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick KostonandPaulus Schoutsen authored and GitHub committed 2020-05-28 21:09:07 -07:00
1 parent 9c45115468
commit fbe7b4ddfa
13 files changed
+173 -63

No files matched your search

+3 -3
View File
@@ -14,7 +14,7 @@ from aiohttp.web_exceptions import (
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.const import CONTENT_TYPE_JSON, HTTP_OK
from homeassistant.const import CONTENT_TYPE_JSON, HTTP_OK, HTTP_SERVICE_UNAVAILABLE
from homeassistant.core import Context, is_callback
from homeassistant.helpers.json import JSONEncoder
@@ -107,8 +107,8 @@ def request_handler_factory(view: HomeAssistantView, handler: Callable) -> Calla
async def handle(request: web.Request) -> web.StreamResponse:
"""Handle incoming request."""
if not request.app[KEY_HASS].is_running:
return web.Response(status=503)
if request.app[KEY_HASS].is_stopping:
return web.Response(status=HTTP_SERVICE_UNAVAILABLE)
authenticated = request.get(KEY_AUTHENTICATED, False)