mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 02:19:31 +00:00
Refactor integration startup time to show wall clock time (#113707)
* Refactor setup time tracking to exclude time waiting on other operations We now exclude the import time and th time waiting on base platforms to setup from the setup times * tweak * tweak * tweak * tweak * adjust * fixes * fixes * preen * preen * tweak * tweak * adjust * tweak * reduce * do not count integrtion platforms against their parent integration * handle legacy tts platforms * stt as well * one more wait * use the same pattern in all the legacy * fix tts and stt legacy * fix * fix * reduce * preen * entity comp does not wait for platforms * scene blocks as well * fix test * test fixes * coverage * coverage * coverage * fix test * Update tests/test_setup.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update tests/test_setup.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/setup.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * strip * strip WAIT_PLATFORM_INTEGRATION * strip WAIT_PLATFORM_INTEGRATION * strip WAIT_PLATFORM_INTEGRATION * strip WAIT_PLATFORM_INTEGRATION * remove complexity * Apply suggestions from code review * no longer works that way * fixes * fixes * fixes --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
@@ -1172,6 +1172,13 @@ class Integration:
|
||||
raise self._missing_platforms_cache[full_name]
|
||||
return None
|
||||
|
||||
def platforms_are_loaded(self, platform_names: Iterable[str]) -> bool:
|
||||
"""Check if a platforms are loaded for an integration."""
|
||||
return all(
|
||||
f"{self.domain}.{platform_name}" in self._cache
|
||||
for platform_name in platform_names
|
||||
)
|
||||
|
||||
def get_platform_cached(self, platform_name: str) -> ModuleType | None:
|
||||
"""Return a platform for an integration from cache."""
|
||||
return self._cache.get(f"{self.domain}.{platform_name}") # type: ignore[return-value]
|
||||
|
||||
Reference in New Issue
Block a user