mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-13 20:26:29 +00:00
Release all pending WebSocket calls on connection close (#3401)
This commit is contained in:
parent
603d19b075
commit
8071b107e7
@ -51,6 +51,12 @@ class WSClient:
|
|||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
"""Close down the client."""
|
"""Close down the client."""
|
||||||
|
for future in self._futures.values():
|
||||||
|
if not future.done():
|
||||||
|
future.set_exception(
|
||||||
|
HomeAssistantWSConnectionError("Connection was closed")
|
||||||
|
)
|
||||||
|
|
||||||
if not self._client.closed:
|
if not self._client.closed:
|
||||||
await self._client.close()
|
await self._client.close()
|
||||||
|
|
||||||
@ -234,6 +240,7 @@ class HomeAssistantWebSocket(CoreSysAttributes):
|
|||||||
except HomeAssistantWSConnectionError:
|
except HomeAssistantWSConnectionError:
|
||||||
await self._client.close()
|
await self._client.close()
|
||||||
self._client = None
|
self._client = None
|
||||||
|
raise
|
||||||
|
|
||||||
async def async_supervisor_update_event(
|
async def async_supervisor_update_event(
|
||||||
self,
|
self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user