Fix memory leaks in websocket api (#94780)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
a7d327afa2
commit
1206f2c1da
5 changed files with 244 additions and 84 deletions
|
@ -1,9 +1,7 @@
|
|||
"""Websocket constants."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable, Callable
|
||||
from concurrent import futures
|
||||
from typing import TYPE_CHECKING, Any, Final
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -42,10 +40,6 @@ ERR_TEMPLATE_ERROR: Final = "template_error"
|
|||
|
||||
TYPE_RESULT: Final = "result"
|
||||
|
||||
# Define the possible errors that occur when connections are cancelled.
|
||||
# Originally, this was just asyncio.CancelledError, but issue #9546 showed
|
||||
# that futures.CancelledErrors can also occur in some situations.
|
||||
CANCELLATION_ERRORS: Final = (asyncio.CancelledError, futures.CancelledError)
|
||||
|
||||
# Event types
|
||||
SIGNAL_WEBSOCKET_CONNECTED: Final = "websocket_connected"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue