Reduce one iteration of pending flows in the discovery flow helper (#110918)
parent
19cf80d5c5
commit
c74958dd36
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue