mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix race condition in Matter unsubscribe method (#103770)
This commit is contained in:
parent
818bc12f87
commit
0e4186ff8a
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable
|
||||
from contextlib import suppress
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
@ -110,7 +111,9 @@ class MatterEntity(Entity):
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Run when entity will be removed from hass."""
|
||||
for unsub in self._unsubscribes:
|
||||
unsub()
|
||||
with suppress(ValueError):
|
||||
# suppress ValueError to prevent race conditions
|
||||
unsub()
|
||||
|
||||
@callback
|
||||
def _on_matter_event(self, event: EventType, data: Any = None) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user