Выполнение работы на 4.

This commit is contained in:
2026-11-13 21:41:50 +03:00
parent ec540a1a72
commit 6308f21ec7
104 changed files with 7310 additions and 13 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
"""Wait for the public LB to route requests to a ready API replica."""
import argparse
import time
import urllib.error
import urllib.request
p = argparse.ArgumentParser()
p.add_argument('--base-url', default='http://localhost:18084')
args = p.parse_args()
deadline = time.monotonic()+90
while True:
try:
with urllib.request.urlopen(args.base_url.rstrip('/')+'/health/ready', timeout=3) as response:
if response.status == 200:
print('PASS: API is ready through the load balancer.')
break
except (urllib.error.URLError, OSError):
pass
if time.monotonic() >= deadline:
raise SystemExit('FAIL: API did not become ready in 90 seconds')
time.sleep(.5)