Make hass.async_stop an untracked task (#88738)

This commit is contained in:
J. Nick Koston
2023-02-25 12:07:19 +01:00
committed by Franck Nijhof
parent 833ccafb76
commit 6196607c5d
+4 -1
View File
@@ -1,4 +1,5 @@
"""Signal handling related helpers."""
import asyncio
import logging
import signal
@@ -23,7 +24,9 @@ def async_register_signal_handling(hass: HomeAssistant) -> None:
"""
hass.loop.remove_signal_handler(signal.SIGTERM)
hass.loop.remove_signal_handler(signal.SIGINT)
hass.async_create_task(hass.async_stop(exit_code))
hass.data["homeassistant_stop"] = asyncio.create_task(
hass.async_stop(exit_code)
)
try:
hass.loop.add_signal_handler(signal.SIGTERM, async_signal_handle, 0)