mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-06 14:10:13 -03:00
fix(recipes): eliminate O(n) fuzzy search fallback over 42k+ recipes
Drop the SequenceMatcher-based fuzzy_match fallback that froze the server when FTS returned empty results. FTS now returns empty set for zero results (no fallback), and when the index is not yet ready, search returns empty rather than scanning all items in Python.
This commit is contained in:
@@ -77,7 +77,15 @@ def recipe_scanner(tmp_path: Path, monkeypatch):
|
||||
monkeypatch.setattr(config, "loras_roots", [str(tmp_path)])
|
||||
stub = StubLoraScanner()
|
||||
scanner = RecipeScanner(lora_scanner=stub)
|
||||
asyncio.run(scanner.refresh_cache(force=True))
|
||||
|
||||
async def _init():
|
||||
await scanner.refresh_cache(force=True)
|
||||
# Wait for FTS index build to finish — asyncio.run()
|
||||
# cancels background tasks on return, so we must await it here.
|
||||
if scanner._fts_index_task:
|
||||
await scanner._fts_index_task
|
||||
|
||||
asyncio.run(_init())
|
||||
yield scanner, stub
|
||||
RecipeScanner._instance = None
|
||||
settings_manager_module.reset_settings_manager()
|
||||
|
||||
Reference in New Issue
Block a user