From 3164eef05916604a32e1d818de6cee8bd984eea7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 20 Apr 2021 06:16:17 -1000 Subject: [PATCH] Limit executor jobs during custom_components load to match non-custom behavior (#49451) --- homeassistant/loader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 492233d8bca..51bd0c2da1f 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -23,6 +23,7 @@ from homeassistant.generated.dhcp import DHCP from homeassistant.generated.mqtt import MQTT from homeassistant.generated.ssdp import SSDP from homeassistant.generated.zeroconf import HOMEKIT, ZEROCONF +from homeassistant.util.async_ import gather_with_concurrency # Typing imports that create a circular dependency if TYPE_CHECKING: @@ -128,13 +129,14 @@ async def _async_get_custom_components( get_sub_directories, custom_components.__path__ ) - integrations = await asyncio.gather( + integrations = await gather_with_concurrency( + MAX_LOAD_CONCURRENTLY, *( hass.async_add_executor_job( Integration.resolve_from_root, hass, custom_components, comp.name ) for comp in dirs - ) + ), ) return {