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:
parent
518e462e9a
commit
94bf55e29b
6 changed files with 68 additions and 9 deletions
|
@ -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],
|
||||
),
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue