Skip to content

Commit

Permalink
Fix task leak on config entry unload/retry (#96981)
Browse files Browse the repository at this point in the history
Since the task was added to self._tasks without a `task.add_done_callback(self._tasks.remove)`
each unload/retry would leak a new set of tasks
  • Loading branch information
bdraco committed Jul 21, 2023
1 parent 99def97 commit 9fba687
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion homeassistant/config_entries.py
Expand Up @@ -687,7 +687,7 @@ async def _async_process_on_unload(self, hass: HomeAssistant) -> None:
if self._on_unload is not None:
while self._on_unload:
if job := self._on_unload.pop()():
self._tasks.add(hass.async_create_task(job))
self.async_create_task(hass, job)

if not self._tasks and not self._background_tasks:
return
Expand Down

0 comments on commit 9fba687

Please sign in to comment.