mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-19 09:27:02 +08:00
Cached scanned filenames until next object_info call
This commit is contained in:
parent
314e526c5c
commit
a66309e0e2
@ -139,12 +139,21 @@ def get_full_path(folder_name, filename):
|
|||||||
return full_path
|
return full_path
|
||||||
|
|
||||||
|
|
||||||
|
filename_list_cache = {}
|
||||||
|
|
||||||
|
|
||||||
|
def clear_cache():
|
||||||
|
filename_list_cache = {}
|
||||||
|
|
||||||
|
|
||||||
def get_filename_list(folder_name):
|
def get_filename_list(folder_name):
|
||||||
global folder_names_and_paths
|
global folder_names_and_paths, cache
|
||||||
output_list = set()
|
|
||||||
folders = folder_names_and_paths[folder_name]
|
|
||||||
for x in folders[0]:
|
|
||||||
output_list.update(filter_files_extensions(recursive_search(x), folders[1]))
|
|
||||||
return sorted(list(output_list))
|
|
||||||
|
|
||||||
|
if folder_name not in filename_list_cache:
|
||||||
|
output_list = set()
|
||||||
|
folders = folder_names_and_paths[folder_name]
|
||||||
|
for x in folders[0]:
|
||||||
|
output_list.update(filter_files_extensions(recursive_search(x), folders[1]))
|
||||||
|
filename_list_cache[folder_name] = sorted(list(output_list))
|
||||||
|
|
||||||
|
return filename_list_cache[folder_name]
|
||||||
|
|||||||
@ -257,6 +257,7 @@ class PromptServer():
|
|||||||
|
|
||||||
@routes.get("/object_info")
|
@routes.get("/object_info")
|
||||||
async def get_object_info(request):
|
async def get_object_info(request):
|
||||||
|
folder_paths.clear_cache()
|
||||||
out = {}
|
out = {}
|
||||||
for x in nodes.NODE_CLASS_MAPPINGS:
|
for x in nodes.NODE_CLASS_MAPPINGS:
|
||||||
obj_class = nodes.NODE_CLASS_MAPPINGS[x]
|
obj_class = nodes.NODE_CLASS_MAPPINGS[x]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user