mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add cache to split_entity_id (#71345)
This commit is contained in:
parent
e3433008a2
commit
8a41370950
@ -133,9 +133,12 @@ SOURCE_YAML = ConfigSource.YAML.value
|
|||||||
# How long to wait until things that run on startup have to finish.
|
# How long to wait until things that run on startup have to finish.
|
||||||
TIMEOUT_EVENT_START = 15
|
TIMEOUT_EVENT_START = 15
|
||||||
|
|
||||||
|
MAX_EXPECTED_ENTITY_IDS = 16384
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache(MAX_EXPECTED_ENTITY_IDS)
|
||||||
def split_entity_id(entity_id: str) -> tuple[str, str]:
|
def split_entity_id(entity_id: str) -> tuple[str, str]:
|
||||||
"""Split a state entity ID into domain and object ID."""
|
"""Split a state entity ID into domain and object ID."""
|
||||||
domain, _, object_id = entity_id.partition(".")
|
domain, _, object_id = entity_id.partition(".")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user