Complete lab 3 load balancing and resilience

This commit is contained in:
sinveria
2026-11-05 18:29:36 +03:00
parent 0ab3a341aa
commit 1e1fd22ccf
73 changed files with 4507 additions and 26 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env python3
import sys
import time
import urllib.request
url = sys.argv[1] if len(sys.argv) > 1 else 'http://localhost:8080/health/ready'
timeout = int(sys.argv[2]) if len(sys.argv) > 2 else 30
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
try:
with urllib.request.urlopen(url, timeout=2) as response:
if response.status == 200:
raise SystemExit(0)
except Exception:
time.sleep(0.5)
raise SystemExit('Readiness timeout: ' + url)