mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Adjust ConfigEntry.async_setup comments to be more clear (#110726)
This commit is contained in:
parent
ef9f117baa
commit
4c11371898
@ -512,16 +512,19 @@ class ConfigEntry:
|
||||
)
|
||||
result = False
|
||||
|
||||
#
|
||||
# After successfully calling async_setup_entry, it is important that this function
|
||||
# does not yield to the event loop by using `await` or `async with` or
|
||||
# similar until after the state has been set by calling self._async_set_state.
|
||||
#
|
||||
# Otherwise we risk that any `call_soon`s
|
||||
# created by an integration will be executed before the state is set.
|
||||
#
|
||||
|
||||
# Only store setup result as state if it was not forwarded.
|
||||
if not domain_is_integration:
|
||||
return
|
||||
|
||||
#
|
||||
# It is important that this function does not yield to the
|
||||
# event loop by using `await` or `async with` or similar until
|
||||
# after the state has been set. Otherwise we risk that any `call_soon`s
|
||||
# created by an integration will be executed before the state is set.
|
||||
#
|
||||
if result:
|
||||
self._async_set_state(hass, ConfigEntryState.LOADED, None)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user