mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Fix missing await when running shutdown jobs (#106632)
This commit is contained in:
parent
f84d865c51
commit
bb6f3bc830
@ -889,7 +889,7 @@ class HomeAssistant:
|
|||||||
continue
|
continue
|
||||||
tasks.append(task_or_none)
|
tasks.append(task_or_none)
|
||||||
if tasks:
|
if tasks:
|
||||||
asyncio.gather(*tasks, return_exceptions=True)
|
await asyncio.gather(*tasks, return_exceptions=True)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Timed out waiting for shutdown jobs to complete, the shutdown will"
|
"Timed out waiting for shutdown jobs to complete, the shutdown will"
|
||||||
|
@ -2605,6 +2605,9 @@ async def test_shutdown_job(hass: HomeAssistant) -> None:
|
|||||||
evt = asyncio.Event()
|
evt = asyncio.Event()
|
||||||
|
|
||||||
async def shutdown_func() -> None:
|
async def shutdown_func() -> None:
|
||||||
|
# Sleep to ensure core is waiting for the task to finish
|
||||||
|
await asyncio.sleep(0.01)
|
||||||
|
# Set the event
|
||||||
evt.set()
|
evt.set()
|
||||||
|
|
||||||
job = HassJob(shutdown_func, "shutdown_job")
|
job = HassJob(shutdown_func, "shutdown_job")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user