Skip to content

Commit 08e2b65

Browse files
authored
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
1 parent 1a8857a commit 08e2b65

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

homeassistant/config_entries.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,10 +2578,11 @@ def _handle_entry_updated(
25782578
self._remove_call_later = async_call_later(
25792579
self.hass,
25802580
RELOAD_AFTER_UPDATE_DELAY,
2581-
HassJob(self._handle_reload, cancel_on_shutdown=True),
2581+
HassJob(self._async_handle_reload, cancel_on_shutdown=True),
25822582
)
25832583

2584-
async def _handle_reload(self, _now: Any) -> None:
2584+
@callback
2585+
def _async_handle_reload(self, _now: Any) -> None:
25852586
"""Handle a reload."""
25862587
self._remove_call_later = None
25872588
to_reload = self.changed
@@ -2594,16 +2595,8 @@ async def _handle_reload(self, _now: Any) -> None:
25942595
),
25952596
", ".join(to_reload),
25962597
)
2597-
2598-
await asyncio.gather(
2599-
*(
2600-
asyncio.create_task(
2601-
self.hass.config_entries.async_reload(entry_id),
2602-
name="config entry reload {entry.title} {entry.domain} {entry.entry_id}",
2603-
)
2604-
for entry_id in to_reload
2605-
)
2606-
)
2598+
for entry_id in to_reload:
2599+
self.hass.config_entries.async_schedule_reload(entry_id)
26072600

26082601

26092602
@callback

0 commit comments

Comments
 (0)