mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Prevent log flooding in frame helper (#61085)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,9 @@ from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# Keep track of integrations already reported to prevent flooding
|
||||
_REPORTED_INTEGRATIONS: set[str] = set()
|
||||
|
||||
CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name
|
||||
|
||||
|
||||
@@ -85,6 +88,12 @@ def report_integration(
|
||||
"""
|
||||
found_frame, integration, path = integration_frame
|
||||
|
||||
# Keep track of integrations already reported to prevent flooding
|
||||
key = f"{found_frame.filename}:{found_frame.lineno}"
|
||||
if key in _REPORTED_INTEGRATIONS:
|
||||
return
|
||||
_REPORTED_INTEGRATIONS.add(key)
|
||||
|
||||
index = found_frame.filename.index(path)
|
||||
if path == "custom_components/":
|
||||
extra = " to the custom component author"
|
||||
|
||||
Reference in New Issue
Block a user