Detect blocking module imports in the event loop (#114488)

This commit is contained in:
J. Nick Koston
2024-03-30 19:51:31 -10:00
committed by GitHub
parent f01235ef74
commit 5038a035bd
9 changed files with 600 additions and 281 deletions

View File

@ -23,7 +23,14 @@ import cryptography.hazmat.backends.openssl.backend # noqa: F401
import voluptuous as vol
import yarl
from . import config as conf_util, config_entries, core, loader, requirements
from . import (
block_async_io,
config as conf_util,
config_entries,
core,
loader,
requirements,
)
# Pre-import frontend deps which have no requirements here to avoid
# loading them at run time and blocking the event loop. We do this ahead
@ -260,6 +267,8 @@ async def async_setup_hass(
_LOGGER.info("Config directory: %s", runtime_config.config_dir)
loader.async_setup(hass)
block_async_io.enable()
config_dict = None
basic_setup_success = False