forked from mtusi2026/mtusi2026lab5
lab5 na4
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
python3 - "${1:-120}" <<'PYTHON'
|
||||
import sys,time,urllib.request,urllib.error
|
||||
end=time.monotonic()+int(sys.argv[1])
|
||||
while time.monotonic()<end:
|
||||
try:
|
||||
with urllib.request.urlopen('http://localhost:8080/health/ready',timeout=3) as r:
|
||||
if r.status==200:
|
||||
print('ready');sys.exit(0)
|
||||
except (OSError,urllib.error.URLError):
|
||||
pass
|
||||
time.sleep(1)
|
||||
raise SystemExit('API not ready before deadline')
|
||||
PYTHON
|
||||
Reference in New Issue
Block a user