mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +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):
|
if debug := _LOGGER.isEnabledFor(logging.DEBUG):
|
||||||
start = time.perf_counter()
|
start = time.perf_counter()
|
||||||
domain = self.domain
|
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.
|
# Some integrations fail on import because they call functions incorrectly.
|
||||||
# So we do it before validating config to catch these errors.
|
# 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:
|
if load_executor:
|
||||||
try:
|
try:
|
||||||
comp = await self.hass.async_add_import_executor_job(self.get_component)
|
comp = await self.hass.async_add_import_executor_job(self.get_component)
|
||||||
@ -918,8 +916,7 @@ class Integration:
|
|||||||
load_executor = (
|
load_executor = (
|
||||||
self.import_executor
|
self.import_executor
|
||||||
and domain not in self.hass.config.components
|
and domain not in self.hass.config.components
|
||||||
and f"hass.components.{domain}" not in sys.modules
|
and f"{self.pkg_path}.{domain}" not in sys.modules
|
||||||
and f"custom_components.{domain}" not in sys.modules
|
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
if load_executor:
|
if load_executor:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user