fix: stop starting replicas with the compose grace period in the driver

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 16:51:25 +03:00
co-authored by Claude Opus 5.5
parent 42e6edf420
commit f6052f6c30
+7 -1
View File
@@ -1211,6 +1211,9 @@ EVENT_PREFIXES = (STARTED_SERVER, SERVER_RUNNING, "Finished server process")
STOP_LABEL = "mtusi.stop-at-start"
# docker stop стартующего контейнера — не дольше (спек graceful-shutdown)
STOP_LIMIT_S = 1.0
# срок docker stop — stop_grace_period сервиса api в compose; явно: без
# --timeout у контейнера docker run Docker Desktop 29 ждёт ~3 с, а не 10
STOP_GRACE_S = 10
# ожидание события die и строки старта сервера
ATTEMPT_TIMEOUT_S = 30
@@ -1387,7 +1390,10 @@ def stop_attempt(
finally:
timer.cancel()
began = time.monotonic()
subprocess.run(["docker", "stop", container], capture_output=True)
subprocess.run(
["docker", "stop", "--timeout", str(STOP_GRACE_S), container],
capture_output=True,
)
stop_s = time.monotonic() - began
if delay is None:
follow.kill()