Skip to content

Commit

Permalink
Revert "Fix blocking I/O while validating config schema" (home-assist…
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored Aug 8, 2024
1 parent a406068 commit 60117ae
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions homeassistant/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,7 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: dict) -> Non
This method is a coroutine.
"""
# CORE_CONFIG_SCHEMA is not async safe since it uses vol.IsDir
# so we need to run it in an executor job.
config = await hass.async_add_executor_job(CORE_CONFIG_SCHEMA, config)
config = CORE_CONFIG_SCHEMA(config)

# Only load auth during startup.
if not hasattr(hass, "auth"):
Expand Down Expand Up @@ -1535,15 +1533,9 @@ async def async_process_component_config(
return IntegrationConfigInfo(None, config_exceptions)

# No custom config validator, proceed with schema validation
if config_schema := getattr(component, "CONFIG_SCHEMA", None):
if hasattr(component, "CONFIG_SCHEMA"):
try:
if domain in config:
# cv.isdir, cv.isfile, cv.isdevice are not async
# friendly so we need to run this in executor
schema = await hass.async_add_executor_job(config_schema, config)
else:
schema = config_schema(config)
return IntegrationConfigInfo(schema, [])
return IntegrationConfigInfo(component.CONFIG_SCHEMA(config), [])
except vol.Invalid as exc:
exc_info = ConfigExceptionInfo(
exc,
Expand Down

0 comments on commit 60117ae

Please sign in to comment.