Remove sleep in async_setup_component (#115515)

Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
pull/115564/head
J. Nick Koston 2024-04-13 19:34:28 -05:00 committed by GitHub
parent 14b794b0f7
commit dad03e7283
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 4 deletions

View File

@ -428,10 +428,9 @@ async def _async_setup_component( # noqa: C901
await load_translations_task await load_translations_task
if integration.platforms_exists(("config_flow",)): if integration.platforms_exists(("config_flow",)):
# If the integration has a config_flow, flush out async_setup calling create_task # If the integration has a config_flow, wait for import flows.
# with an asyncio.sleep(0) so we can wait for import flows. # As these are all created with eager tasks, we do not sleep here,
# Fragile but covered by test. # as the tasks will always be started before we reach this point.
await asyncio.sleep(0)
await hass.config_entries.flow.async_wait_import_flow_initialized(domain) await hass.config_entries.flow.async_wait_import_flow_initialized(domain)
# Add to components before the entry.async_setup # Add to components before the entry.async_setup