Wait until the webui backend responds with a 200 OK to ping requests

This commit is contained in:
cmdr2 2024-10-07 12:39:07 +05:30
parent 6f4e2017f4
commit 9abc76482c

View File

@ -68,7 +68,10 @@ def ping(timeout=1):
global webui_opts
try:
webui_get("/internal/ping", timeout=timeout)
res = webui_get("/internal/ping", timeout=timeout)
if res.status_code != 200:
raise ConnectTimeout(res.text)
if webui_opts is None:
try:
@ -85,7 +88,7 @@ def ping(timeout=1):
webui_opts = res.json()
except Exception as e:
print(f"Error setting options: {e}")
print(f"Error getting options: {e}")
return True
except ConnectTimeout as e: