1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Reduce one iteration of pending flows in the discovery flow helper (#110918)

This commit is contained in:
J. Nick Koston
2024-02-19 02:57:39 -06:00
committed by GitHub
parent 19cf80d5c5
commit c74958dd36

View File

@@ -86,17 +86,20 @@ class FlowDispatcher:
pending_flows = self.pending_flows
self.pending_flows = {}
self.started = True
init_coros = [
_async_init_flow(
self.hass, flow_key.domain, flow_values.context, flow_values.data
)
init_coros = (
init_coro
for flow_key, flows in pending_flows.items()
for flow_values in flows
]
await gather_with_limited_concurrency(
FLOW_INIT_LIMIT,
*[init_coro for init_coro in init_coros if init_coro is not None],
if (
init_coro := _async_init_flow(
self.hass,
flow_key.domain,
flow_values.context,
flow_values.data,
)
)
)
await gather_with_limited_concurrency(FLOW_INIT_LIMIT, *init_coros)
@callback
def async_create(self, domain: str, context: dict[str, Any], data: Any) -> None: