From 7474d353cd4de81eb887e843d2de0b1c8b6f0f98 Mon Sep 17 00:00:00 2001 From: Josue Zamudio Date: Wed, 26 Aug 2026 18:36:52 +0000 Subject: [PATCH] run.sh: actually restart the server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pkill TERM alone never worked: uvicorn's graceful shutdown waits for in-flight /stream requests (minutes long), so the old process held the port and each new one died with EADDRINUSE — meaning the live server was running days-old code while the static files (read from disk per request) were current - SIGKILL fallback after the 1s grace, and --timeout-graceful-shutdown 3 so TERM is reliable on its own going forward - this is why the new heatmap rendered an empty grid: the stale process served /api/stats without by_day --- run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index aead454..9362c2f 100755 --- a/run.sh +++ b/run.sh @@ -3,7 +3,10 @@ cd "$(dirname "$0")" || exit 1 [ -x .venv/bin/python ] || { echo "no .venv — run: uv venv .venv && uv pip install --python .venv/bin/python -r requirements.txt"; exit 1; } pkill -f "uvicorn .*app:app" 2>/dev/null; sleep 1 +# graceful shutdown waits for in-flight /stream requests; force-kill anything +# still holding the port, or the old process outlives the restart +pkill -9 -f "uvicorn .*app:app" 2>/dev/null # ANIWEB_SECURE=1: session cookie is Secure — only usable via the HTTPS # proxy (plain http://:8321 can no longer hold a session). -ANIWEB_SECURE=1 nohup .venv/bin/python -m uvicorn server.app:app --host 0.0.0.0 --port 8321 > server.log 2>&1 & +ANIWEB_SECURE=1 nohup .venv/bin/python -m uvicorn server.app:app --host 0.0.0.0 --port 8321 --timeout-graceful-shutdown 3 > server.log 2>&1 & echo "ani-web on http://localhost:8321 (pid $!) — use the HTTPS proxy to log in"