From 08e2b655be16c82ea64e77847cdd552a0f0459e5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 13 Apr 2024 10:30:59 -1000 Subject: [PATCH] Migrate EntityRegistryDisabledHandler to use async_schedule_reload (#115544) async_schedule_reload ensures that any setup retries are cancelled before executing the reload. Its unlikely in this case but its still possible --- homeassistant/config_entries.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 572b6583d94..194f09bcca8 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -2578,10 +2578,11 @@ class EntityRegistryDisabledHandler: self._remove_call_later = async_call_later( self.hass, RELOAD_AFTER_UPDATE_DELAY, - HassJob(self._handle_reload, cancel_on_shutdown=True), + HassJob(self._async_handle_reload, cancel_on_shutdown=True), ) - async def _handle_reload(self, _now: Any) -> None: + @callback + def _async_handle_reload(self, _now: Any) -> None: """Handle a reload.""" self._remove_call_later = None to_reload = self.changed @@ -2594,16 +2595,8 @@ class EntityRegistryDisabledHandler: ), ", ".join(to_reload), ) - - await asyncio.gather( - *( - asyncio.create_task( - self.hass.config_entries.async_reload(entry_id), - name="config entry reload {entry.title} {entry.domain} {entry.entry_id}", - ) - for entry_id in to_reload - ) - ) + for entry_id in to_reload: + self.hass.config_entries.async_schedule_reload(entry_id) @callback