Add a message to the config entry cancel call (#96925)

This commit is contained in:
J. Nick Koston 2023-07-19 19:22:38 -05:00 committed by GitHub
parent 955bed0128
commit 6bb81b862c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(