mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-14 00:24:23 +08:00
improve: parallel fetch & update
This commit is contained in:
parent
214197a24d
commit
e532dbca00
19
__init__.py
19
__init__.py
@ -9,9 +9,9 @@ import re
|
|||||||
import locale
|
import locale
|
||||||
import subprocess # don't remove this
|
import subprocess # don't remove this
|
||||||
from tqdm.auto import tqdm
|
from tqdm.auto import tqdm
|
||||||
|
import concurrent
|
||||||
|
|
||||||
|
version = "V0.40"
|
||||||
version = "V0.39.3"
|
|
||||||
print(f"### Loading: ComfyUI-Manager ({version})")
|
print(f"### Loading: ComfyUI-Manager ({version})")
|
||||||
|
|
||||||
|
|
||||||
@ -554,9 +554,13 @@ def check_custom_nodes_installed(json_obj, do_fetch=False, do_update_check=True,
|
|||||||
elif do_update_check:
|
elif do_update_check:
|
||||||
print("Start update check...", end="")
|
print("Start update check...", end="")
|
||||||
|
|
||||||
for item in json_obj['custom_nodes']:
|
def process_custom_node(item):
|
||||||
check_a_custom_node_installed(item, do_fetch, do_update_check, do_update)
|
check_a_custom_node_installed(item, do_fetch, do_update_check, do_update)
|
||||||
|
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(4) as executor:
|
||||||
|
for item in json_obj['custom_nodes']:
|
||||||
|
executor.submit(process_custom_node, item)
|
||||||
|
|
||||||
if do_fetch:
|
if do_fetch:
|
||||||
print(f"\x1b[2K\rFetching done.")
|
print(f"\x1b[2K\rFetching done.")
|
||||||
elif do_update:
|
elif do_update:
|
||||||
@ -677,10 +681,9 @@ async def fetch_alternatives_list(request):
|
|||||||
|
|
||||||
|
|
||||||
def check_model_installed(json_obj):
|
def check_model_installed(json_obj):
|
||||||
for item in json_obj['models']:
|
def process_model(item):
|
||||||
item['installed'] = 'None'
|
|
||||||
|
|
||||||
model_path = get_model_path(item)
|
model_path = get_model_path(item)
|
||||||
|
item['installed'] = 'None'
|
||||||
|
|
||||||
if model_path is not None:
|
if model_path is not None:
|
||||||
if os.path.exists(model_path):
|
if os.path.exists(model_path):
|
||||||
@ -688,6 +691,10 @@ def check_model_installed(json_obj):
|
|||||||
else:
|
else:
|
||||||
item['installed'] = 'False'
|
item['installed'] = 'False'
|
||||||
|
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(8) as executor:
|
||||||
|
for item in json_obj['models']:
|
||||||
|
executor.submit(process_model, item)
|
||||||
|
|
||||||
|
|
||||||
@server.PromptServer.instance.routes.get("/externalmodel/getlist")
|
@server.PromptServer.instance.routes.get("/externalmodel/getlist")
|
||||||
async def fetch_externalmodel_list(request):
|
async def fetch_externalmodel_list(request):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user