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 possiblepull/115546/head
parent
1a8857aa2e
commit
08e2b655be
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue