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:
J. Nick Koston 2024-04-27 18:42:29 -05:00 committed by GitHub
parent 9fb01f3956
commit 50405fae5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1408,6 +1408,7 @@ class _OneTimeListener(Generic[_DataT]):
EMPTY_LIST: list[Any] = []
@functools.lru_cache
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."""
if len(event_type) > MAX_LENGTH_EVENT_EVENT_TYPE: