Option to Skip Symlink Scanning for Network Paths #10605
+37
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Skip Symlink Scanning for Network Paths
Problem
When a symlink in the lora folder points to a network path containing many LoRA files, ComfyUI experiences severe performance degradation. Workflows that normally take 5-10 seconds can take 11+ minutes because ComfyUI attempts to recursively scan and list all files in the symlinked network directory before executing workflows, even when using the API with direct file paths.
Solution
Added a
--skip-symlink-scancommand-line flag that prevents ComfyUI from following symlinks during directory scanning operations. This allows:symlink/SDXL/my_lora.safetensors),get_full_path()can still resolve and access files through symlinks because it uses direct file existence checks rather than directory scanningChanges Made
1. Added CLI Argument (
comfy/cli_args.py)--skip-symlink-scanflag to control symlink following behavior during directory scanning2. Modified
recursive_search()(folder_paths.py)--skip-symlink-scanflagos.walk()traversal3. Modified
recursive_search_models_()(app/model_manager.py)Usage
Run ComfyUI with the flag:
This prevents the performance slowdown while still allowing filen paths to work. Note that dropdown lists in the frontend will not show files from symlinked directories when this flag is enabled, but direct API usage is unaffected.
Technical Details
get_full_path()usesos.path.isfile()which automatically resolves symlinks, so direct file access continues to workos.walk()withfollowlinks=Falsewhen the flag is setos.path.islink()and filtered out before traversal