Skip to content

Commit

Permalink
break reference cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Jun 19, 2023
1 parent 09839c9 commit 7a9e023
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions homeassistant/components/websocket_api/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ def handle_hass_stop(event: Event) -> None:
finally:
unsub_stop()

self._cancel_peak_checker()

if connection is not None:
connection.async_handle_close()

Expand Down Expand Up @@ -424,4 +426,14 @@ def handle_hass_stop(event: Event) -> None:

async_dispatcher_send(self.hass, SIGNAL_WEBSOCKET_DISCONNECTED)

# Break reference cycles to make sure GC can happen sooner
self.wsock = None # type: ignore[assignment]
self.request = None # type: ignore[assignment]
self.hass = None # type: ignore[assignment]
self._logger = None # type: ignore[assignment]
self._message_queue = None # type: ignore[assignment]
self._handle_task = None
self._writer_task = None
self._ready_future = None

return wsock

0 comments on commit 7a9e023

Please sign in to comment.