Skip to content

Commit

Permalink
Bump core shutdown timeout for new pre-stopping core state (#4736)
Browse files Browse the repository at this point in the history
* Bump core shutdown timeout

* Clarify comment

* Update tests
  • Loading branch information
emontnemery authored Nov 28, 2023
1 parent e8c4b32 commit 95ac53d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions supervisor/docker/homeassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ def name(self) -> str:
@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:
Expand Down
4 changes: 2 additions & 2 deletions tests/homeassistant/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

Expand Down

0 comments on commit 95ac53d

Please sign in to comment.