Skip to content

Commit

Permalink
feat: set the fetch-service to idle shutdown
Browse files Browse the repository at this point in the history
Set it to shutdown after 5 minutes of no live sessions.
  • Loading branch information
tigarmo committed Sep 18, 2024
1 parent e931a59 commit e546fae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions craft_application/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ def start_service() -> subprocess.Popen[str] | None:
# Accept permissive sessions
cmd.append("--permissive-mode")

# Shutdown after 5 minutes with no live sessions
cmd.append("--idle-shutdown=300")

log_filepath = _get_log_filepath()
log_filepath.parent.mkdir(parents=True, exist_ok=True)

Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def test_start_service(mocker, tmp_path):
f"--cert={fake_cert}",
f"--key={fake_key}",
"--permissive-mode",
"--idle-shutdown=300",
]
)
+ f" > {fetch._get_log_filepath()}",
Expand Down

0 comments on commit e546fae

Please sign in to comment.