mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Reduce samsungtv startup time (#112007)
Create the startup tasks eagerly This one is a bit high
This commit is contained in:
parent
4249d17c1b
commit
5f65315e86
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Coroutine, Sequence
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from async_upnp_client.aiohttp import AiohttpNotifyServer, AiohttpSessionRequester
|
||||
@ -35,6 +35,7 @@ from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.trigger import PluggableAction
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
|
||||
from .bridge import SamsungTVBridge, SamsungTVWSBridge
|
||||
from .const import CONF_SSDP_RENDERING_CONTROL_LOCATION, DOMAIN, LOGGER
|
||||
@ -171,15 +172,15 @@ class SamsungTVDevice(SamsungTVEntity, MediaPlayerEntity):
|
||||
await self._dmr_device.async_unsubscribe_services()
|
||||
return
|
||||
|
||||
startup_tasks: list[Coroutine[Any, Any, Any]] = []
|
||||
startup_tasks: list[asyncio.Task[Any]] = []
|
||||
|
||||
if not self._app_list_event.is_set():
|
||||
startup_tasks.append(self._async_startup_app_list())
|
||||
startup_tasks.append(create_eager_task(self._async_startup_app_list()))
|
||||
|
||||
if self._dmr_device and not self._dmr_device.is_subscribed:
|
||||
startup_tasks.append(self._async_resubscribe_dmr())
|
||||
startup_tasks.append(create_eager_task(self._async_resubscribe_dmr()))
|
||||
if not self._dmr_device and self._ssdp_rendering_control_location:
|
||||
startup_tasks.append(self._async_startup_dmr())
|
||||
startup_tasks.append(create_eager_task(self._async_startup_dmr()))
|
||||
|
||||
if startup_tasks:
|
||||
await asyncio.gather(*startup_tasks)
|
||||
|
Loading…
x
Reference in New Issue
Block a user