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

pull/86374/head
J. Nick Koston 2023-01-21 17:20:33 -10:00 committed by GitHub
parent 8227c84e05
commit c842666bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -392,6 +392,10 @@ async def ws_event_stream(
force_send=True,
)
if msg_id not in connection.subscriptions:
# Unsubscribe happened while sending historical events
return
live_stream.task = asyncio.create_task(
_async_events_consumer(
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(
get_instance(hass).async_block_till_done()
)