Fix race when disabling config entries (#47210)

* Fix race when disabling config entries

* Remove unused constant
This commit is contained in:
Erik Montnemery 2021-03-01 12:38:49 +01:00 committed by GitHub
parent dadc99dbd3
commit 003fee2a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -69,8 +69,6 @@ ENTRY_STATE_SETUP_RETRY = "setup_retry"
ENTRY_STATE_NOT_LOADED = "not_loaded"
# An error occurred when trying to unload the entry
ENTRY_STATE_FAILED_UNLOAD = "failed_unload"
# The config entry is disabled
ENTRY_STATE_DISABLED = "disabled"
UNRECOVERABLE_STATES = (ENTRY_STATE_MIGRATION_ERROR, ENTRY_STATE_FAILED_UNLOAD)
@ -802,11 +800,14 @@ class ConfigEntries:
entry.disabled_by = disabled_by
self._async_schedule_save()
# Unload the config entry, then fire an event
reload_result = await self.async_reload(entry_id)
self.hass.bus.async_fire(
EVENT_CONFIG_ENTRY_DISABLED_BY_UPDATED, {"config_entry_id": entry_id}
)
return await self.async_reload(entry_id)
return reload_result
@callback
def async_update_entry(