mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Load config entry platforms eagerly (#111498)
We can avoid one event loop iteration to start the tasks here.
This commit is contained in:
parent
ce0fb1e716
commit
7d9fa2f407
@ -57,6 +57,7 @@ from .helpers.typing import UNDEFINED, ConfigType, DiscoveryInfoType, UndefinedT
|
|||||||
from .loader import async_suggest_report_issue
|
from .loader import async_suggest_report_issue
|
||||||
from .setup import DATA_SETUP_DONE, async_process_deps_reqs, async_setup_component
|
from .setup import DATA_SETUP_DONE, async_process_deps_reqs, async_setup_component
|
||||||
from .util import uuid as uuid_util
|
from .util import uuid as uuid_util
|
||||||
|
from .util.async_ import create_eager_task
|
||||||
from .util.decorator import Registry
|
from .util.decorator import Registry
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -1729,7 +1730,7 @@ class ConfigEntries:
|
|||||||
"""Forward the setup of an entry to platforms."""
|
"""Forward the setup of an entry to platforms."""
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
*(
|
*(
|
||||||
asyncio.create_task(
|
create_eager_task(
|
||||||
self.async_forward_entry_setup(entry, platform),
|
self.async_forward_entry_setup(entry, platform),
|
||||||
name=f"config entry forward setup {entry.title} {entry.domain} {entry.entry_id} {platform}",
|
name=f"config entry forward setup {entry.title} {entry.domain} {entry.entry_id} {platform}",
|
||||||
)
|
)
|
||||||
@ -1765,7 +1766,7 @@ class ConfigEntries:
|
|||||||
return all(
|
return all(
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
*(
|
*(
|
||||||
asyncio.create_task(
|
create_eager_task(
|
||||||
self.async_forward_entry_unload(entry, platform),
|
self.async_forward_entry_unload(entry, platform),
|
||||||
name=f"config entry forward unload {entry.title} {entry.domain} {entry.entry_id} {platform}",
|
name=f"config entry forward unload {entry.title} {entry.domain} {entry.entry_id} {platform}",
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user