ЛР 3: балансировка, общая идемпотентность и исследование масштабирования
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
url = os.getenv('BASE_URL', 'http://localhost:8080') + '/health/ready'
|
||||
deadline = time.monotonic() + 90
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=2) as response:
|
||||
if response.status == 200:
|
||||
print('PASS: LB readiness')
|
||||
break
|
||||
except OSError:
|
||||
pass
|
||||
if time.monotonic() >= deadline:
|
||||
raise SystemExit('Readiness timeout')
|
||||
time.sleep(0.5)
|
||||
Reference in New Issue
Block a user