From 6bb81b862cbd47a019341c2d056a5837e8c9dbd1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 19 Jul 2023 19:22:38 -0500 Subject: [PATCH] Add a message to the config entry cancel call (#96925) --- homeassistant/config_entries.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 825064e5410..eccac004b7e 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -692,8 +692,9 @@ class ConfigEntry: if not self._tasks and not self._background_tasks: return + cancel_message = f"Config entry {self.title} with {self.domain} unloading" for task in self._background_tasks: - task.cancel() + task.cancel(cancel_message) _, pending = await asyncio.wait( [*self._tasks, *self._background_tasks], timeout=10 @@ -885,7 +886,9 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager): """Cancel any initializing flows.""" for task_list in self._initialize_tasks.values(): for task in task_list: - task.cancel() + task.cancel( + "Config entry initialize canceled: Home Assistant is shutting down" + ) await self._discovery_debouncer.async_shutdown() async def async_finish_flow(