Fix task leak on config entry unload/retry (#96981)

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
pull/96936/head
J. Nick Koston 2023-07-20 20:00:07 -05:00 committed by Franck Nijhof
parent fd3bdeaef1
commit 4644355eff
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 1 additions and 1 deletions

View File

@ -694,7 +694,7 @@ class ConfigEntry:
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