mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add a cache to _verify_event_type_length_or_raise (#116312)
Most of the time the events being fired are the same so we can skip the python code in this function
This commit is contained in:
parent
9fb01f3956
commit
50405fae5f
@ -1408,6 +1408,7 @@ class _OneTimeListener(Generic[_DataT]):
|
|||||||
EMPTY_LIST: list[Any] = []
|
EMPTY_LIST: list[Any] = []
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache
|
||||||
def _verify_event_type_length_or_raise(event_type: EventType[_DataT] | str) -> None:
|
def _verify_event_type_length_or_raise(event_type: EventType[_DataT] | str) -> None:
|
||||||
"""Verify the length of the event type and raise if too long."""
|
"""Verify the length of the event type and raise if too long."""
|
||||||
if len(event_type) > MAX_LENGTH_EVENT_EVENT_TYPE:
|
if len(event_type) > MAX_LENGTH_EVENT_EVENT_TYPE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user