Implement lab4 grade 3: private S3 attachments and persistence checks
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"""Wait for the public entrypoint after starting the Compose stack."""
|
||||
import os
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
base = os.getenv('BASE_URL', 'http://127.0.0.1:8084').rstrip('/')
|
||||
deadline = time.monotonic() + 90
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(base + '/health/ready', timeout=3) as response:
|
||||
if response.status == 200:
|
||||
print('READY:', base)
|
||||
break
|
||||
except (urllib.error.URLError, OSError):
|
||||
pass
|
||||
if time.monotonic() >= deadline:
|
||||
raise SystemExit('Public API did not become ready within 90 seconds')
|
||||
time.sleep(.5)
|
||||
Reference in New Issue
Block a user