mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Simplify load_executor check in loader (#112029)
This commit is contained in:
parent
14b737e9b8
commit
567d4d5926
@ -844,13 +844,11 @@ class Integration:
|
||||
if debug := _LOGGER.isEnabledFor(logging.DEBUG):
|
||||
start = time.perf_counter()
|
||||
domain = self.domain
|
||||
load_executor = (
|
||||
self.import_executor
|
||||
and f"hass.components.{domain}" not in sys.modules
|
||||
and f"custom_components.{domain}" not in sys.modules
|
||||
)
|
||||
# Some integrations fail on import because they call functions incorrectly.
|
||||
# So we do it before validating config to catch these errors.
|
||||
load_executor = (
|
||||
self.import_executor and f"{self.pkg_path}.{domain}" not in sys.modules
|
||||
)
|
||||
if load_executor:
|
||||
try:
|
||||
comp = await self.hass.async_add_import_executor_job(self.get_component)
|
||||
@ -918,8 +916,7 @@ class Integration:
|
||||
load_executor = (
|
||||
self.import_executor
|
||||
and domain not in self.hass.config.components
|
||||
and f"hass.components.{domain}" not in sys.modules
|
||||
and f"custom_components.{domain}" not in sys.modules
|
||||
and f"{self.pkg_path}.{domain}" not in sys.modules
|
||||
)
|
||||
try:
|
||||
if load_executor:
|
||||
|
Loading…
x
Reference in New Issue
Block a user