mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Reduce latency to set up websocket forwarding in hassio (#111558)
Reduce latancy to set up websocket forwarding in hassio Create the tasks eagerly to avoid one iteration of the event loop to connect the proxy
This commit is contained in:
parent
ae2ce99cbd
commit
321295a872
@ -18,6 +18,7 @@ from homeassistant.components.http import HomeAssistantView
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.typing import UNDEFINED
|
from homeassistant.helpers.typing import UNDEFINED
|
||||||
|
from homeassistant.util.async_ import create_eager_task
|
||||||
|
|
||||||
from .const import X_HASS_SOURCE, X_INGRESS_PATH
|
from .const import X_HASS_SOURCE, X_INGRESS_PATH
|
||||||
from .http import should_compress
|
from .http import should_compress
|
||||||
@ -143,8 +144,8 @@ class HassIOIngress(HomeAssistantView):
|
|||||||
# Proxy requests
|
# Proxy requests
|
||||||
await asyncio.wait(
|
await asyncio.wait(
|
||||||
[
|
[
|
||||||
asyncio.create_task(_websocket_forward(ws_server, ws_client)),
|
create_eager_task(_websocket_forward(ws_server, ws_client)),
|
||||||
asyncio.create_task(_websocket_forward(ws_client, ws_server)),
|
create_eager_task(_websocket_forward(ws_client, ws_server)),
|
||||||
],
|
],
|
||||||
return_when=asyncio.FIRST_COMPLETED,
|
return_when=asyncio.FIRST_COMPLETED,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user