Limit executor jobs during custom_components load to match non-custom behavior (#49451)

This commit is contained in:
J. Nick Koston 2021-04-20 06:16:17 -10:00 committed by GitHub
parent f600649016
commit 3164eef059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ from homeassistant.generated.dhcp import DHCP
from homeassistant.generated.mqtt import MQTT from homeassistant.generated.mqtt import MQTT
from homeassistant.generated.ssdp import SSDP from homeassistant.generated.ssdp import SSDP
from homeassistant.generated.zeroconf import HOMEKIT, ZEROCONF from homeassistant.generated.zeroconf import HOMEKIT, ZEROCONF
from homeassistant.util.async_ import gather_with_concurrency
# Typing imports that create a circular dependency # Typing imports that create a circular dependency
if TYPE_CHECKING: if TYPE_CHECKING:
@ -128,13 +129,14 @@ async def _async_get_custom_components(
get_sub_directories, custom_components.__path__ get_sub_directories, custom_components.__path__
) )
integrations = await asyncio.gather( integrations = await gather_with_concurrency(
MAX_LOAD_CONCURRENTLY,
*( *(
hass.async_add_executor_job( hass.async_add_executor_job(
Integration.resolve_from_root, hass, custom_components, comp.name Integration.resolve_from_root, hass, custom_components, comp.name
) )
for comp in dirs for comp in dirs
) ),
) )
return { return {