mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Streamline discovery flow callback (#76666)
This commit is contained in:
parent
2e40fc7288
commit
2f29f38ec6
@ -60,17 +60,14 @@ class FlowDispatcher:
|
|||||||
@callback
|
@callback
|
||||||
def async_setup(self) -> None:
|
def async_setup(self) -> None:
|
||||||
"""Set up the flow disptcher."""
|
"""Set up the flow disptcher."""
|
||||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, self.async_start)
|
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, self._async_start)
|
||||||
|
|
||||||
@callback
|
async def _async_start(self, event: Event) -> None:
|
||||||
def async_start(self, event: Event) -> None:
|
|
||||||
"""Start processing pending flows."""
|
"""Start processing pending flows."""
|
||||||
self.hass.data.pop(DISCOVERY_FLOW_DISPATCHER)
|
self.hass.data.pop(DISCOVERY_FLOW_DISPATCHER)
|
||||||
self.hass.async_create_task(self._async_process_pending_flows())
|
|
||||||
|
|
||||||
async def _async_process_pending_flows(self) -> None:
|
|
||||||
"""Process any pending discovery flows."""
|
|
||||||
init_coros = [_async_init_flow(self.hass, *flow) for flow in self.pending_flows]
|
init_coros = [_async_init_flow(self.hass, *flow) for flow in self.pending_flows]
|
||||||
|
|
||||||
await gather_with_concurrency(
|
await gather_with_concurrency(
|
||||||
FLOW_INIT_LIMIT,
|
FLOW_INIT_LIMIT,
|
||||||
*[init_coro for init_coro in init_coros if init_coro is not None],
|
*[init_coro for init_coro in init_coros if init_coro is not None],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user