Implement lab3 load balancing and idempotent messaging

This commit is contained in:
ferraronp
2026-11-06 18:57:11 +03:00
parent 0ab3a341aa
commit 303c60e2e1
27 changed files with 1133 additions and 33 deletions
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
# Run tests/load.py in a second terminal while this script recreates API instances.
for replica in api1 api2; do
docker compose --env-file .env up -d --no-deps --force-recreate "$replica"
docker compose --env-file .env exec -T "$replica" python - <<'PY'
import time,urllib.request
for _ in range(40):
try:
if urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=2).status==200:break
except Exception:pass
time.sleep(.5)
else:raise SystemExit('replica did not recover')
PY
sleep 3
done