From 95ac53d7808c52dd84fcda4431c132625aa495e9 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 28 Nov 2023 21:03:25 +0100 Subject: [PATCH] Bump core shutdown timeout for new pre-stopping core state (#4736) * Bump core shutdown timeout * Clarify comment * Update tests --- supervisor/docker/homeassistant.py | 7 ++++--- tests/homeassistant/test_core.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/supervisor/docker/homeassistant.py b/supervisor/docker/homeassistant.py index ea5507ce5..0502420a2 100644 --- a/supervisor/docker/homeassistant.py +++ b/supervisor/docker/homeassistant.py @@ -53,9 +53,10 @@ class DockerHomeAssistant(DockerInterface): @property def timeout(self) -> int: """Return timeout for Docker actions.""" - # Synchronized homeassistant's S6_SERVICES_GRACETIME - # to avoid killing Home Assistant Core - return 220 + 20 + # Synchronized with the homeassistant core container's S6_SERVICES_GRACETIME + # to avoid killing Home Assistant Core, see + # https://github.com/home-assistant/core/tree/dev/Dockerfile + return 240 + 20 @property def ip_address(self) -> IPv4Address: diff --git a/tests/homeassistant/test_core.py b/tests/homeassistant/test_core.py index 7dbcacc09..7adf5a899 100644 --- a/tests/homeassistant/test_core.py +++ b/tests/homeassistant/test_core.py @@ -218,7 +218,7 @@ async def test_stop(coresys: CoreSys, exists: bool): coresys.docker.containers.get.return_value.remove.assert_not_called() if exists: coresys.docker.containers.get.return_value.stop.assert_called_once_with( - timeout=240 + timeout=260 ) else: coresys.docker.containers.get.return_value.stop.assert_not_called() @@ -231,7 +231,7 @@ async def test_restart(coresys: CoreSys): block_till_run.assert_called_once() coresys.docker.containers.get.return_value.restart.assert_called_once_with( - timeout=240 + timeout=260 ) coresys.docker.containers.get.return_value.stop.assert_not_called()