1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 14:08:21 +00:00

Improve performance of waiting for after dependencies and device config entries (#110902)

To wait for after dependencies we created a task to wait an asyncio.Event object,
instead of using an Event we can use an asyncio.Future instead and avoid the need
for a task wrapper
This commit is contained in:
J. Nick Koston
2024-02-19 03:28:50 -06:00
committed by GitHub
parent a21d65d025
commit 4bc28489c5
2 changed files with 11 additions and 11 deletions

View File

@@ -1741,8 +1741,8 @@ class ConfigEntries:
Config entries which are created after Home Assistant is started can't be waited
for, the function will just return if the config entry is loaded or not.
"""
if setup_event := self.hass.data.get(DATA_SETUP_DONE, {}).get(entry.domain):
await setup_event.wait()
if setup_future := self.hass.data.get(DATA_SETUP_DONE, {}).get(entry.domain):
await setup_future
# The component was not loaded.
if entry.domain not in self.hass.config.components:
return False