Small code cleanups (#822)

* Small code cleanups

* Update homeassistant.py
This commit is contained in:
Pascal Vizeli 2018-11-19 16:44:21 +01:00 committed by GitHub
parent a5ecd597ed
commit 254d6aee32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -471,21 +471,18 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
while True:
await asyncio.sleep(10)
# 1
# Check if Container is is_running
# 1: Check if Container is is_running
if not await self.instance.is_running():
_LOGGER.error("Home Assistant has crashed!")
break
# 2
# Check if API response
# 2: Check if API response
if await self.sys_run_in_executor(check_port):
_LOGGER.info("Detect a running Home Assistant instance")
self._error_state = False
return
# 3
# Running DB Migration
# 3: Running DB Migration
if migration_file.exists():
if not migration_progress:
migration_progress = True
@ -496,8 +493,7 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
start_time = time.monotonic()
_LOGGER.info("Home Assistant record migration done")
# 4
# Timeout
# 4: Timeout
if time.monotonic() - start_time > self.wait_boot:
_LOGGER.warning(
"Don't wait anymore of Home Assistant startup!")