Avoid linear search of entity registry in async_clear_config_entry (#109724)

pull/109756/head
J. Nick Koston 2024-02-05 14:12:16 -06:00 committed by GitHub
parent e9a41e5023
commit 908cedf981
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -1218,9 +1218,8 @@ class EntityRegistry:
"""Clear config entry from registry entries.""" """Clear config entry from registry entries."""
now_time = time.time() now_time = time.time()
for entity_id in [ for entity_id in [
entity_id entry.entity_id
for entity_id, entry in self.entities.items() for entry in self.entities.get_entries_for_config_entry_id(config_entry_id)
if config_entry_id == entry.config_entry_id
]: ]:
self.async_remove(entity_id) self.async_remove(entity_id)
for key, deleted_entity in list(self.deleted_entities.items()): for key, deleted_entity in list(self.deleted_entities.items()):