mirror of
https://github.com/home-assistant/core.git
synced 2025-11-14 13:30:43 +00:00
Limit concurrency of async_get_integration to avoid creating extra threads (#43085)
* Limit concurrency of async_get_integration to avoid creating extra threads Since async_get_integration is waiting on the disk most of the time it would end up creating many new threads because the disk could not deliver the data in time. * pylint
This commit is contained in:
@@ -6,11 +6,13 @@ from typing import Any, Dict, List, Optional, Set
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.loader import (
|
||||
MAX_LOAD_CONCURRENTLY,
|
||||
Integration,
|
||||
async_get_config_flows,
|
||||
async_get_integration,
|
||||
bind_hass,
|
||||
)
|
||||
from homeassistant.util.async_ import gather_with_concurrency
|
||||
from homeassistant.util.json import load_json
|
||||
|
||||
from .typing import HomeAssistantType
|
||||
@@ -151,8 +153,9 @@ async def async_get_component_strings(
|
||||
integrations = dict(
|
||||
zip(
|
||||
domains,
|
||||
await asyncio.gather(
|
||||
*[async_get_integration(hass, domain) for domain in domains]
|
||||
await gather_with_concurrency(
|
||||
MAX_LOAD_CONCURRENTLY,
|
||||
*[async_get_integration(hass, domain) for domain in domains],
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user