Create tasks eagerly in the discovery flow helper (#111557)
The likely outcome from most discoveries is an near immediate abort so we run them eagerly to avoid having to schedule on the event loop for the common casepull/111575/head^2
parent
b75277cc24
commit
ae2ce99cbd
|
@ -29,7 +29,9 @@ def async_create_flow(
|
||||||
|
|
||||||
if not dispatcher or dispatcher.started:
|
if not dispatcher or dispatcher.started:
|
||||||
if init_coro := _async_init_flow(hass, domain, context, data):
|
if init_coro := _async_init_flow(hass, domain, context, data):
|
||||||
hass.async_create_task(init_coro, f"discovery flow {domain} {context}")
|
hass.async_create_task(
|
||||||
|
init_coro, f"discovery flow {domain} {context}", eager_start=True
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
return dispatcher.async_create(domain, context, data)
|
return dispatcher.async_create(domain, context, data)
|
||||||
|
|
Loading…
Reference in New Issue