fixed: Bug fix in glob/manager_server.py that prevented cache updates when installed via pip. (#2237)

Until the cacheless implementation is fully applied, the cache must always be updated — otherwise, various parts of the system will malfunction.
This commit is contained in:
Dr.Lt.Data 2025-10-21 07:16:57 +09:00 committed by GitHub
parent e0640e7014
commit 079ac254ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 11 deletions

View File

@ -11,6 +11,7 @@ from . import manager_util
import requests import requests
import toml import toml
import logging
base_url = "https://api.comfy.org" base_url = "https://api.comfy.org"
@ -23,7 +24,7 @@ async def get_cnr_data(cache_mode=True, dont_wait=True):
try: try:
return await _get_cnr_data(cache_mode, dont_wait) return await _get_cnr_data(cache_mode, dont_wait)
except asyncio.TimeoutError: except asyncio.TimeoutError:
print("A timeout occurred during the fetch process from ComfyRegistry.") logging.info("A timeout occurred during the fetch process from ComfyRegistry.")
return await _get_cnr_data(cache_mode=True, dont_wait=True) # timeout fallback return await _get_cnr_data(cache_mode=True, dont_wait=True) # timeout fallback
async def _get_cnr_data(cache_mode=True, dont_wait=True): async def _get_cnr_data(cache_mode=True, dont_wait=True):
@ -79,12 +80,12 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True):
full_nodes[x['id']] = x full_nodes[x['id']] = x
if page % 5 == 0: if page % 5 == 0:
print(f"FETCH ComfyRegistry Data: {page}/{sub_json_obj['totalPages']}") logging.info(f"FETCH ComfyRegistry Data: {page}/{sub_json_obj['totalPages']}")
page += 1 page += 1
time.sleep(0.5) time.sleep(0.5)
print("FETCH ComfyRegistry Data [DONE]") logging.info("FETCH ComfyRegistry Data [DONE]")
for v in full_nodes.values(): for v in full_nodes.values():
if 'latest_version' not in v: if 'latest_version' not in v:
@ -100,7 +101,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True):
if cache_state == 'not-cached': if cache_state == 'not-cached':
return {} return {}
else: else:
print("[ComfyUI-Manager] The ComfyRegistry cache update is still in progress, so an outdated cache is being used.") logging.info("[ComfyUI-Manager] The ComfyRegistry cache update is still in progress, so an outdated cache is being used.")
with open(manager_util.get_cache_path(uri), 'r', encoding="UTF-8", errors="ignore") as json_file: with open(manager_util.get_cache_path(uri), 'r', encoding="UTF-8", errors="ignore") as json_file:
return json.load(json_file)['nodes'] return json.load(json_file)['nodes']
@ -114,7 +115,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True):
return json_obj['nodes'] return json_obj['nodes']
except Exception: except Exception:
res = {} res = {}
print("Cannot connect to comfyregistry.") logging.warning("Cannot connect to comfyregistry.")
finally: finally:
if cache_mode: if cache_mode:
is_cache_loading = False is_cache_loading = False
@ -240,7 +241,7 @@ def generate_cnr_id(fullpath, cnr_id):
with open(cnr_id_path, "w") as f: with open(cnr_id_path, "w") as f:
return f.write(cnr_id) return f.write(cnr_id)
except Exception: except Exception:
print(f"[ComfyUI Manager] unable to create file: {cnr_id_path}") logging.error(f"[ComfyUI Manager] unable to create file: {cnr_id_path}")
def read_cnr_id(fullpath): def read_cnr_id(fullpath):

View File

@ -1003,7 +1003,6 @@ class UnifiedManager:
""" """
result = ManagedResult('enable') result = ManagedResult('enable')
if 'comfyui-manager' in node_id.lower(): if 'comfyui-manager' in node_id.lower():
return result.fail(f"ignored: enabling '{node_id}'") return result.fail(f"ignored: enabling '{node_id}'")

View File

@ -2045,10 +2045,7 @@ async def default_cache_update():
) )
traceback.print_exc() traceback.print_exc()
if ( if core.get_config()["network_mode"] != "offline":
core.get_config()["network_mode"] != "offline"
and not manager_util.is_manager_pip_package()
):
a = get_cache("custom-node-list.json") a = get_cache("custom-node-list.json")
b = get_cache("extension-node-map.json") b = get_cache("extension-node-map.json")
c = get_cache("model-list.json") c = get_cache("model-list.json")