mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Create config entry async_on_unload tasks eagerly (#113626)
This commit is contained in:
parent
91fa612301
commit
6a6f3d46a9
@ -857,7 +857,7 @@ class ConfigEntry:
|
|||||||
if self._on_unload is not None:
|
if self._on_unload is not None:
|
||||||
while self._on_unload:
|
while self._on_unload:
|
||||||
if job := self._on_unload.pop()():
|
if job := self._on_unload.pop()():
|
||||||
self.async_create_task(hass, job)
|
self.async_create_task(hass, job, eager_start=True)
|
||||||
|
|
||||||
if not self._tasks and not self._background_tasks:
|
if not self._tasks and not self._background_tasks:
|
||||||
return
|
return
|
||||||
|
@ -113,6 +113,7 @@ async def test_flow_reauth(hass: HomeAssistant) -> None:
|
|||||||
entry.add_to_hass(hass)
|
entry.add_to_hass(hass)
|
||||||
with _patch_init_hole(mocked_hole), _patch_config_flow_hole(mocked_hole):
|
with _patch_init_hole(mocked_hole), _patch_config_flow_hole(mocked_hole):
|
||||||
assert not await hass.config_entries.async_setup(entry.entry_id)
|
assert not await hass.config_entries.async_setup(entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
flows = hass.config_entries.flow.async_progress()
|
flows = hass.config_entries.flow.async_progress()
|
||||||
|
|
||||||
|
@ -4334,10 +4334,10 @@ async def test_task_tracking(hass: HomeAssistant) -> None:
|
|||||||
hass.loop.call_soon(event.set)
|
hass.loop.call_soon(event.set)
|
||||||
await entry._async_process_on_unload(hass)
|
await entry._async_process_on_unload(hass)
|
||||||
assert results == [
|
assert results == [
|
||||||
"on_unload",
|
|
||||||
"background",
|
"background",
|
||||||
"background",
|
"background",
|
||||||
"normal",
|
"normal",
|
||||||
|
"on_unload",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user