Revert the speed up from starting the browser early. Not sure why the fastapi server isn't ready to serve static html by this point, will need to investigate later

This commit is contained in:
cmdr2 2023-07-10 09:01:48 +05:30
parent 6dfabb692d
commit e43bf2b93a
2 changed files with 17 additions and 17 deletions

View File

@ -473,15 +473,15 @@ def start_render_thread(device):
render_threads.append(rthread)
finally:
manager_lock.release()
# timeout = DEVICE_START_TIMEOUT
# while not rthread.is_alive() or not rthread in weak_thread_data or not "device" in weak_thread_data[rthread]:
# if rthread in weak_thread_data and "error" in weak_thread_data[rthread]:
# log.error(f"{rthread}, {device}, error: {weak_thread_data[rthread]['error']}")
# return False
# if timeout <= 0:
# return False
# timeout -= 1
# time.sleep(1)
timeout = DEVICE_START_TIMEOUT
while not rthread.is_alive() or not rthread in weak_thread_data or not "device" in weak_thread_data[rthread]:
if rthread in weak_thread_data and "error" in weak_thread_data[rthread]:
log.error(f"{rthread}, {device}, error: {weak_thread_data[rthread]['error']}")
return False
if timeout <= 0:
return False
timeout -= 1
time.sleep(1)
return True
@ -535,12 +535,12 @@ def update_render_threads(render_devices, active_devices):
if not start_render_thread(device):
log.warn(f"{device} failed to start.")
# if is_alive() <= 0: # No running devices, probably invalid user config.
# raise EnvironmentError(
# 'ERROR: No active render devices! Please verify the "render_devices" value in config.json'
# )
if is_alive() <= 0: # No running devices, probably invalid user config.
raise EnvironmentError(
'ERROR: No active render devices! Please verify the "render_devices" value in config.json'
)
# log.debug(f"active devices: {get_devices()['active']}")
log.debug(f"active devices: {get_devices()['active']}")
def shutdown_event(): # Signal render thread to close on shutdown

View File

@ -1,12 +1,12 @@
from easydiffusion import model_manager, app, server
from easydiffusion.server import server_api # required for uvicorn
server.init()
# Init the app
model_manager.init()
app.init()
server.init()
app.init_render_threads()
# start the browser ui
app.open_browser()
app.init_render_threads()