mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 10:29:27 +00:00
Cache serialize of manifest for loaded integrations (#117965)
* Cache serialize of manifest for loaded integrations The manifest/list and manifest/get websocket apis are called frequently when moving around in the UI. Since the manifest does not change we can make the the serialized version a cached property * reduce * reduce
This commit is contained in:
@@ -39,6 +39,7 @@ from .generated.mqtt import MQTT
|
||||
from .generated.ssdp import SSDP
|
||||
from .generated.usb import USB
|
||||
from .generated.zeroconf import HOMEKIT, ZEROCONF
|
||||
from .helpers.json import json_bytes, json_fragment
|
||||
from .util.hass_dict import HassKey
|
||||
from .util.json import JSON_DECODE_EXCEPTIONS, json_loads
|
||||
|
||||
@@ -762,6 +763,11 @@ class Integration:
|
||||
self._top_level_files = top_level_files or set()
|
||||
_LOGGER.info("Loaded %s from %s", self.domain, pkg_path)
|
||||
|
||||
@cached_property
|
||||
def manifest_json_fragment(self) -> json_fragment:
|
||||
"""Return manifest as a JSON fragment."""
|
||||
return json_fragment(json_bytes(self.manifest))
|
||||
|
||||
@cached_property
|
||||
def name(self) -> str:
|
||||
"""Return name."""
|
||||
|
||||
Reference in New Issue
Block a user