mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Reduce latency to connect websocket writer (#111559)
Reduce latancy to connect websocket writer Use an eager start task to start the writer
This commit is contained in:
parent
321295a872
commit
ebdfff4037
@ -16,6 +16,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
from homeassistant.util.json import json_loads
|
||||
|
||||
from .auth import AUTH_REQUIRED_MESSAGE, AuthPhase
|
||||
@ -336,7 +337,7 @@ class WebSocketHandler:
|
||||
# We only start the writer queue after the auth phase is completed
|
||||
# since there is no need to queue messages before the auth phase
|
||||
self._connection = connection
|
||||
self._writer_task = asyncio.create_task(self._writer(send_bytes_text))
|
||||
self._writer_task = create_eager_task(self._writer(send_bytes_text))
|
||||
hass.data[DATA_CONNECTIONS] = hass.data.get(DATA_CONNECTIONS, 0) + 1
|
||||
async_dispatcher_send(hass, SIGNAL_WEBSOCKET_CONNECTED)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user