diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index c5229634053..f4cfc8c87c8 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -88,7 +88,7 @@ from .helpers import ( ) from .helpers.dispatcher import async_dispatcher_send_internal from .helpers.storage import get_internal_store_manager -from .helpers.system_info import async_get_system_info +from .helpers.system_info import async_get_system_info, is_official_image from .helpers.typing import ConfigType from .setup import ( # _setup_started is marked as protected to make it clear @@ -104,7 +104,7 @@ from .setup import ( from .util.async_ import create_eager_task from .util.hass_dict import HassKey from .util.logging import async_activate_log_queue_handler -from .util.package import async_get_user_site, is_virtual_env +from .util.package import async_get_user_site, is_docker_env, is_virtual_env with contextlib.suppress(ImportError): # Ensure anyio backend is imported to avoid it being imported in the event loop @@ -407,6 +407,10 @@ def _init_blocking_io_modules_in_executor() -> None: # Initialize the mimetypes module to avoid blocking calls # to the filesystem to load the mime.types file. mimetypes.init() + # Initialize is_official_image and is_docker_env to avoid blocking calls + # to the filesystem. + is_official_image() + is_docker_env() async def async_load_base_functionality(hass: core.HomeAssistant) -> None: