mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Move legacy stt setup to use tracked tasks (#113718)
* Move legacy stt setup to use tracked tasks * comment
This commit is contained in:
parent
10f2d8b4b1
commit
719d373bd7
@ -3,7 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
import asyncio
|
||||
from collections.abc import AsyncIterable
|
||||
from dataclasses import asdict
|
||||
import logging
|
||||
@ -127,8 +126,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
component.register_shutdown()
|
||||
platform_setups = async_setup_legacy(hass, config)
|
||||
|
||||
if platform_setups:
|
||||
await asyncio.wait([asyncio.create_task(setup) for setup in platform_setups])
|
||||
for setup in platform_setups:
|
||||
# Tasks are created as tracked tasks to ensure startup
|
||||
# waits for them to finish, but we explicitly do not
|
||||
# want to wait for them to finish here because we want
|
||||
# any config entries that use stt as a base platform
|
||||
# to be able to start with out having to wait for the
|
||||
# legacy platforms to finish setting up.
|
||||
hass.async_create_task(setup, eager_start=True)
|
||||
|
||||
hass.http.register_view(SpeechToTextView(hass.data[DATA_PROVIDERS]))
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user