1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 15:04:50 +08:00

very simple strong-cache on model list (#4969)

* very simple strong-cache on model list

* store the cache after validation too

* only cache object_info for now

* use a 'with' context
This commit is contained in:
Alex "mcmonkey" Goodwin
2024-09-19 17:40:14 +09:00
committed by GitHub
parent 0bfc7cc998
commit a1e71cfad1
2 changed files with 44 additions and 8 deletions

View File

@@ -552,14 +552,15 @@ class PromptServer():
@routes.get("/object_info")
async def get_object_info(request):
out = {}
for x in nodes.NODE_CLASS_MAPPINGS:
try:
out[x] = node_info(x)
except Exception as e:
logging.error(f"[ERROR] An error occurred while retrieving information for the '{x}' node.")
logging.error(traceback.format_exc())
return web.json_response(out)
with folder_paths.cache_helper:
out = {}
for x in nodes.NODE_CLASS_MAPPINGS:
try:
out[x] = node_info(x)
except Exception as e:
logging.error(f"[ERROR] An error occurred while retrieving information for the '{x}' node.")
logging.error(traceback.format_exc())
return web.json_response(out)
@routes.get("/object_info/{node_class}")
async def get_object_info_node(request):