summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mic_clipper/service.py6
-rw-r--r--tests/test_service.py6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/mic_clipper/service.py b/src/mic_clipper/service.py
index ecf5673..2b10710 100644
--- a/src/mic_clipper/service.py
+++ b/src/mic_clipper/service.py
@@ -17,18 +17,18 @@ def render_unit(python: Path, project_root: Path) -> str:
Description=Offline voice-activated microphone clip recorder
Wants=pipewire.service wireplumber.service pipewire-pulse.service
After=pipewire.service wireplumber.service pipewire-pulse.service
+StartLimitIntervalSec=300
+StartLimitBurst=10
[Service]
Type=simple
WorkingDirectory={project_root}
Environment=PYTHONPATH={project_root / 'src'}
-ExecStart={python} -m mic_clipper run
+ExecStart={python} -m mic_clipper.cli run
Restart=on-failure
RestartSec=5s
RestartSteps=5
RestartMaxDelaySec=60s
-StartLimitIntervalSec=300
-StartLimitBurst=10
NoNewPrivileges=yes
PrivateTmp=yes
UMask=0077
diff --git a/tests/test_service.py b/tests/test_service.py
index 2bda2ab..5aacbcc 100644
--- a/tests/test_service.py
+++ b/tests/test_service.py
@@ -3,13 +3,15 @@ from pathlib import Path
from mic_clipper.service import install, render_unit, uninstall
-def test_rendered_service_waits_for_audio_services_and_restarts_only_on_failure():
+def test_rendered_service_uses_cli_entrypoint_and_places_start_limits_in_unit():
unit = render_unit(Path("/runtime/python"), Path("/project"))
assert "After=pipewire.service wireplumber.service pipewire-pulse.service" in unit
+ assert "StartLimitIntervalSec=300" in unit.split("[Service]", maxsplit=1)[0]
+ assert "StartLimitBurst=10" in unit.split("[Service]", maxsplit=1)[0]
assert "Restart=on-failure" in unit
assert "RestartMaxDelaySec=60s" in unit
- assert "ExecStart=/runtime/python -m mic_clipper run" in unit
+ assert "ExecStart=/runtime/python -m mic_clipper.cli run" in unit
assert "UMask=0077" in unit