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 case
pull/111575/head^2
J. Nick Koston 2024-02-26 15:52:04 -10:00 committed by GitHub
parent b75277cc24
commit ae2ce99cbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,9 @@ def async_create_flow(
if not dispatcher or dispatcher.started:
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 dispatcher.async_create(domain, context, data)