mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Small code cleanups (#822)
* Small code cleanups * Update homeassistant.py
This commit is contained in:
parent
a5ecd597ed
commit
254d6aee32
@ -471,21 +471,18 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
|
|
||||||
# 1
|
# 1: Check if Container is is_running
|
||||||
# Check if Container is is_running
|
|
||||||
if not await self.instance.is_running():
|
if not await self.instance.is_running():
|
||||||
_LOGGER.error("Home Assistant has crashed!")
|
_LOGGER.error("Home Assistant has crashed!")
|
||||||
break
|
break
|
||||||
|
|
||||||
# 2
|
# 2: Check if API response
|
||||||
# Check if API response
|
|
||||||
if await self.sys_run_in_executor(check_port):
|
if await self.sys_run_in_executor(check_port):
|
||||||
_LOGGER.info("Detect a running Home Assistant instance")
|
_LOGGER.info("Detect a running Home Assistant instance")
|
||||||
self._error_state = False
|
self._error_state = False
|
||||||
return
|
return
|
||||||
|
|
||||||
# 3
|
# 3: Running DB Migration
|
||||||
# Running DB Migration
|
|
||||||
if migration_file.exists():
|
if migration_file.exists():
|
||||||
if not migration_progress:
|
if not migration_progress:
|
||||||
migration_progress = True
|
migration_progress = True
|
||||||
@ -496,8 +493,7 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
_LOGGER.info("Home Assistant record migration done")
|
_LOGGER.info("Home Assistant record migration done")
|
||||||
|
|
||||||
# 4
|
# 4: Timeout
|
||||||
# Timeout
|
|
||||||
if time.monotonic() - start_time > self.wait_boot:
|
if time.monotonic() - start_time > self.wait_boot:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Don't wait anymore of Home Assistant startup!")
|
"Don't wait anymore of Home Assistant startup!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user