Error reporting while starting the post-installation browser; Temp hack

This commit is contained in:
cmdr2 2024-10-11 13:34:23 +05:30
parent e804247acb
commit cabf4a4f07

View File

@ -102,6 +102,8 @@ def start_backend():
install_backend() install_backend()
was_still_installing = not is_installed() was_still_installing = not is_installed()
print(f"was_still_installing = {was_still_installing}")
was_still_installing = True
if backend_config.get("auto_update", True): if backend_config.get("auto_update", True):
run_in_conda(["git", "add", "-A", "."], cwd=WEBUI_DIR) run_in_conda(["git", "add", "-A", "."], cwd=WEBUI_DIR)
@ -128,7 +130,10 @@ def start_backend():
try: try:
impl.ping(timeout=1) impl.ping(timeout=1)
if was_still_installing and not has_started: # first start is_first_start = not has_started
has_started = True
if was_still_installing and is_first_start:
ui = config.get("ui", {}) ui = config.get("ui", {})
if ui.get("open_browser_on_start", True): if ui.get("open_browser_on_start", True):
@ -137,8 +142,6 @@ def start_backend():
log.info("Opening browser..") log.info("Opening browser..")
webbrowser.open(f"http://localhost:{port}") webbrowser.open(f"http://localhost:{port}")
has_started = True
except (TimeoutError, ConnectionError): except (TimeoutError, ConnectionError):
if has_started: # process probably died if has_started: # process probably died
print("######################## WebUI probably died. Restarting...") print("######################## WebUI probably died. Restarting...")
@ -147,7 +150,9 @@ def start_backend():
backend_thread.start() backend_thread.start()
break break
except Exception: except Exception:
pass import traceback
log.exception(traceback.format_exc())
time.sleep(1) time.sleep(1)