Increase the webui health-check timeout to 30 seconds (from 1 second); Also trap ReadTimeout in the collection of TimeoutError

This commit is contained in:
cmdr2 2024-10-28 18:34:00 +05:30
parent 459bfd4280
commit d4ea34a013
2 changed files with 4 additions and 4 deletions

View File

@ -126,7 +126,7 @@ def start_backend():
while True:
try:
impl.ping(timeout=1)
impl.ping(timeout=30)
is_first_start = not has_started
has_started = True

View File

@ -1,6 +1,6 @@
import os
import requests
from requests.exceptions import ConnectTimeout, ConnectionError
from requests.exceptions import ConnectTimeout, ConnectionError, ReadTimeout
from typing import Union, List
from threading import local as Context
from threading import Thread
@ -8,7 +8,7 @@ import uuid
import time
from copy import deepcopy
from sdkit.utils import base64_str_to_img, img_to_base64_str
from sdkit.utils import base64_str_to_img, img_to_base64_str, log
WEBUI_HOST = "localhost"
WEBUI_PORT = "7860"
@ -91,7 +91,7 @@ def ping(timeout=1):
print(f"Error getting options: {e}")
return True
except (ConnectTimeout, ConnectionError) as e:
except (ConnectTimeout, ConnectionError, ReadTimeout) as e:
raise TimeoutError(e)