forked from mtusi2026/mtusi2026lab3
Implement lab3 load balancing and idempotent messaging
This commit is contained in:
Executable
+17
@@ -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
|
||||
Reference in New Issue
Block a user