Start live history/logbook with eager tasks (#113779)
This commit is contained in:
parent
e3ae66ca64
commit
8b9a8a33f4
2 changed files with 6 additions and 4 deletions
|
@ -36,6 +36,7 @@ from homeassistant.helpers.event import (
|
|||
async_track_state_change_event,
|
||||
)
|
||||
from homeassistant.helpers.json import json_bytes
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import EVENT_COALESCE_TIME, MAX_PENDING_HISTORY_STATES
|
||||
|
@ -536,7 +537,7 @@ async def ws_stream(
|
|||
# Unsubscribe happened while sending historical states
|
||||
return
|
||||
|
||||
live_stream.task = asyncio.create_task(
|
||||
live_stream.task = create_eager_task(
|
||||
_async_events_consumer(
|
||||
subscriptions_setup_complete_time,
|
||||
connection,
|
||||
|
@ -546,7 +547,7 @@ async def ws_stream(
|
|||
)
|
||||
)
|
||||
|
||||
live_stream.wait_sync_task = asyncio.create_task(
|
||||
live_stream.wait_sync_task = create_eager_task(
|
||||
get_instance(hass).async_block_till_done()
|
||||
)
|
||||
await live_stream.wait_sync_task
|
||||
|
|
|
@ -18,6 +18,7 @@ from homeassistant.components.websocket_api.connection import ActiveConnection
|
|||
from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback
|
||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.helpers.json import json_bytes
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -395,7 +396,7 @@ async def ws_event_stream(
|
|||
# Unsubscribe happened while sending historical events
|
||||
return
|
||||
|
||||
live_stream.task = asyncio.create_task(
|
||||
live_stream.task = create_eager_task(
|
||||
_async_events_consumer(
|
||||
subscriptions_setup_complete_time,
|
||||
connection,
|
||||
|
@ -405,7 +406,7 @@ async def ws_event_stream(
|
|||
)
|
||||
)
|
||||
|
||||
live_stream.wait_sync_task = asyncio.create_task(
|
||||
live_stream.wait_sync_task = create_eager_task(
|
||||
get_instance(hass).async_block_till_done()
|
||||
)
|
||||
await live_stream.wait_sync_task
|
||||
|
|
Loading…
Add table
Reference in a new issue