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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user