fixed: Ensure that comfyui_manager's prestartup always runs, even when --disable-all-custom-nodes is used.

feat: Disable specific custom nodes according to the policy of `comfyui_manager`.
This commit is contained in:
Dr.Lt.Data 2025-04-12 20:55:27 +09:00
parent cc975e5f0b
commit 418eaed42c
2 changed files with 10 additions and 2 deletions

View File

@ -70,8 +70,6 @@ def execute_prestartup_script():
if args.disable_all_custom_nodes:
return
comfyui_manager.prestartup()
node_paths = folder_paths.get_folder_paths("custom_nodes")
for custom_node_path in node_paths:
possible_modules = os.listdir(custom_node_path)
@ -79,6 +77,10 @@ def execute_prestartup_script():
for possible_module in possible_modules:
module_path = os.path.join(custom_node_path, possible_module)
if comfyui_manager.should_be_disabled(module_path):
continue
if os.path.isfile(module_path) or module_path.endswith(".disabled") or module_path == "__pycache__":
continue
@ -98,6 +100,7 @@ def execute_prestartup_script():
logging.info("")
apply_custom_paths()
comfyui_manager.prestartup()
execute_prestartup_script()

View File

@ -37,6 +37,7 @@ import importlib
import folder_paths
import latent_preview
import node_helpers
import comfyui_manager
def before_node_execution():
comfy.model_management.throw_exception_if_processing_interrupted()
@ -2196,6 +2197,10 @@ def init_external_custom_nodes():
module_path = os.path.join(custom_node_path, possible_module)
if os.path.isfile(module_path) and os.path.splitext(module_path)[1] != ".py": continue
if module_path.endswith(".disabled"): continue
if comfyui_manager.should_be_disabled(module_path):
logging.info(f"Blocked by policy: {module_path}")
continue
time_before = time.perf_counter()
success = load_custom_node(module_path, base_node_names, module_parent="custom_nodes")
node_import_times.append((time.perf_counter() - time_before, module_path, success))