mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Ensure config entry setup lock is held when removing a config entry (#117086)
This commit is contained in:
@@ -1621,15 +1621,16 @@ class ConfigEntries:
|
||||
if (entry := self.async_get_entry(entry_id)) is None:
|
||||
raise UnknownEntry
|
||||
|
||||
if not entry.state.recoverable:
|
||||
unload_success = entry.state is not ConfigEntryState.FAILED_UNLOAD
|
||||
else:
|
||||
unload_success = await self.async_unload(entry_id)
|
||||
async with entry.setup_lock:
|
||||
if not entry.state.recoverable:
|
||||
unload_success = entry.state is not ConfigEntryState.FAILED_UNLOAD
|
||||
else:
|
||||
unload_success = await self.async_unload(entry_id)
|
||||
|
||||
await entry.async_remove(self.hass)
|
||||
await entry.async_remove(self.hass)
|
||||
|
||||
del self._entries[entry.entry_id]
|
||||
self._async_schedule_save()
|
||||
del self._entries[entry.entry_id]
|
||||
self._async_schedule_save()
|
||||
|
||||
dev_reg = device_registry.async_get(self.hass)
|
||||
ent_reg = entity_registry.async_get(self.hass)
|
||||
|
||||
Reference in New Issue
Block a user