perf(docker-tests): halve poll intervals from 0.5s to 0.25s

Reduce the default interval_s in poll_container, wait_for_docker_logs,
and inline time.sleep() calls in test_dashboard.py and
test_gateway_run_supervised.py from 0.5s to 0.25s.

CI profile with sleep tracking showed 116.2s of time.sleep() across
345 sleep calls — 23% of total wall time. The majority of these
sleeps were in poll_container (0.5s default) and inline polling
loops in the dashboard and gateway-supervised tests. Halving the
interval halves the sleep time for each poll cycle without changing
docker call count or overhead.

Unlike the blocking-exec experiment (which traded fewer calls for
longer per-call duration and regressed on CI), this change only
reduces idle sleep time — the docker exec calls stay the same.
This commit is contained in:
ethernet 2026-07-14 17:38:18 -04:00
parent 3fc4e413d2
commit a7c778e3ba
3 changed files with 8 additions and 8 deletions

View file

@ -276,7 +276,7 @@ def poll_container(
probe: str,
*,
deadline_s: float = 30.0,
interval_s: float = 0.5,
interval_s: float = 0.25,
user: str = "hermes",
) -> tuple[bool, str]:
"""Repeatedly run ``probe`` inside the container until it exits 0 or
@ -343,7 +343,7 @@ def wait_for_log(
def wait_for_docker_logs(
container: str, needle: str, *, deadline_s: float = 30.0, interval_s: float = 0.5,
container: str, needle: str, *, deadline_s: float = 30.0, interval_s: float = 0.25,
) -> str:
"""Poll ``docker logs`` until ``needle`` appears or deadline expires.

View file

@ -165,7 +165,7 @@ def test_dashboard_restarts_after_crash(
if first_pids:
first_pid = first_pids[0]
break
time.sleep(0.5)
time.sleep(0.25)
assert first_pid is not None, "Could not capture initial dashboard PID"
# Kill the dashboard. The dashboard process runs as hermes, so the
@ -180,7 +180,7 @@ def test_dashboard_restarts_after_crash(
pids = r.stdout.strip().split() if r.returncode == 0 else []
if pids and pids[0] != first_pid:
return # success
time.sleep(0.5)
time.sleep(0.25)
raise AssertionError(
f"Dashboard not restarted after kill (first_pid={first_pid})"
@ -255,7 +255,7 @@ except urllib.error.HTTPError as h:
last_err = f"parse: {exc!r} / stdout={r.stdout!r}"
else:
last_err = f"rc={r.returncode} stderr={r.stderr!r}"
time.sleep(0.5)
time.sleep(0.25)
raise AssertionError(
f"Probe of {path} never returned HTTP within {deadline_s}s; "
f"last error: {last_err}"

View file

@ -79,7 +79,7 @@ def _wait_for_gateway_or_exit(
)
if pgrep.returncode == 0:
return "running"
time.sleep(0.5)
time.sleep(0.25)
return status
@ -380,7 +380,7 @@ def test_dashboard_supervised_when_env_set(
if _svstat_wants_up(container_name, "gateway-default"):
ok_gateway = True
break
time.sleep(0.5)
time.sleep(0.25)
assert ok_gateway, (
f"gateway-default slot not want-up: {_svstat(container_name)!r}"
)
@ -391,7 +391,7 @@ def test_dashboard_supervised_when_env_set(
if _svstat_wants_up(container_name, "dashboard"):
ok_dash = True
break
time.sleep(0.5)
time.sleep(0.25)
assert ok_dash, (
f"dashboard slot not want-up: {_svstat(container_name, 'dashboard')!r}"
)