Align max expected entities constant between modules (#118102)
This commit is contained in:
parent
722feb285b
commit
33ff84469a
3 changed files with 10 additions and 5 deletions
|
@ -7,16 +7,15 @@ from functools import lru_cache
|
|||
import re
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import MAX_EXPECTED_ENTITY_IDS
|
||||
from homeassistant.core import split_entity_id
|
||||
|
||||
_MAX_EXPECTED_ENTITIES = 16384
|
||||
|
||||
|
||||
class EntityValues:
|
||||
"""Class to store entity id based values.
|
||||
|
||||
This class is expected to only be used infrequently
|
||||
as it caches all entity ids up to _MAX_EXPECTED_ENTITIES.
|
||||
as it caches all entity ids up to MAX_EXPECTED_ENTITY_IDS.
|
||||
|
||||
The cache includes `self` so it is important to
|
||||
only use this in places where usage of `EntityValues` is immortal.
|
||||
|
@ -41,7 +40,7 @@ class EntityValues:
|
|||
|
||||
self._glob = compiled
|
||||
|
||||
@lru_cache(maxsize=_MAX_EXPECTED_ENTITIES)
|
||||
@lru_cache(maxsize=MAX_EXPECTED_ENTITY_IDS)
|
||||
def get(self, entity_id: str) -> dict[str, str]:
|
||||
"""Get config for an entity id."""
|
||||
domain, _ = split_entity_id(entity_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue