Avoid creating logbook stream task if unsubscribed while waiting for executor (#86363)

This commit is contained in:
J. Nick Koston
2023-01-21 17:20:33 -10:00
committed by GitHub
parent 8227c84e05
commit c842666bea

View File

@@ -392,6 +392,10 @@ async def ws_event_stream(
force_send=True, force_send=True,
) )
if msg_id not in connection.subscriptions:
# Unsubscribe happened while sending historical events
return
live_stream.task = asyncio.create_task( live_stream.task = asyncio.create_task(
_async_events_consumer( _async_events_consumer(
subscriptions_setup_complete_time, subscriptions_setup_complete_time,
@@ -402,10 +406,6 @@ async def ws_event_stream(
) )
) )
if msg_id not in connection.subscriptions:
# Unsubscribe happened while sending historical events
return
live_stream.wait_sync_task = asyncio.create_task( live_stream.wait_sync_task = asyncio.create_task(
get_instance(hass).async_block_till_done() get_instance(hass).async_block_till_done()
) )