forked from mtusi2026/mtusi2026lab4
feat: port lab3 backend foundation to lab4
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user