mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
Remove unused lora monitor retrieval and ignore path logic from ApiRoutes, DownloadManager, and ModelScanner. Fixes #226
This commit is contained in:
@@ -985,17 +985,6 @@ class ApiRoutes:
|
|||||||
renamed_files = []
|
renamed_files = []
|
||||||
new_metadata_path = None
|
new_metadata_path = None
|
||||||
|
|
||||||
# Notify file monitor to ignore these events
|
|
||||||
main_file_path = os.path.join(target_dir, f"{old_file_name}.safetensors")
|
|
||||||
if os.path.exists(main_file_path):
|
|
||||||
# Get lora monitor through ServiceRegistry instead of download_manager
|
|
||||||
lora_monitor = await ServiceRegistry.get_lora_monitor()
|
|
||||||
if lora_monitor:
|
|
||||||
# Add old and new paths to ignore list
|
|
||||||
file_size = os.path.getsize(main_file_path)
|
|
||||||
lora_monitor.handler.add_ignore_path(main_file_path, file_size)
|
|
||||||
lora_monitor.handler.add_ignore_path(new_file_path, file_size)
|
|
||||||
|
|
||||||
for old_path, pattern in existing_files:
|
for old_path, pattern in existing_files:
|
||||||
# Get the file extension like .safetensors or .metadata.json
|
# Get the file extension like .safetensors or .metadata.json
|
||||||
ext = ModelRouteUtils.get_multipart_ext(pattern)
|
ext = ModelRouteUtils.get_multipart_ext(pattern)
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ class DownloadManager:
|
|||||||
self._civitai_client = await ServiceRegistry.get_civitai_client()
|
self._civitai_client = await ServiceRegistry.get_civitai_client()
|
||||||
return self._civitai_client
|
return self._civitai_client
|
||||||
|
|
||||||
async def _get_lora_monitor(self):
|
|
||||||
"""Get the lora file monitor from registry"""
|
|
||||||
return await ServiceRegistry.get_lora_monitor()
|
|
||||||
|
|
||||||
async def _get_checkpoint_monitor(self):
|
async def _get_checkpoint_monitor(self):
|
||||||
"""Get the checkpoint file monitor from registry"""
|
"""Get the checkpoint file monitor from registry"""
|
||||||
return await ServiceRegistry.get_checkpoint_monitor()
|
return await ServiceRegistry.get_checkpoint_monitor()
|
||||||
|
|||||||
@@ -989,26 +989,6 @@ class ModelScanner:
|
|||||||
real_source = os.path.realpath(source_path)
|
real_source = os.path.realpath(source_path)
|
||||||
real_target = os.path.realpath(target_file)
|
real_target = os.path.realpath(target_file)
|
||||||
|
|
||||||
file_size = os.path.getsize(real_source)
|
|
||||||
|
|
||||||
# Get the appropriate file monitor through ServiceRegistry
|
|
||||||
if self.model_type == "lora":
|
|
||||||
monitor = await ServiceRegistry.get_lora_monitor()
|
|
||||||
elif self.model_type == "checkpoint":
|
|
||||||
monitor = await ServiceRegistry.get_checkpoint_monitor()
|
|
||||||
else:
|
|
||||||
monitor = None
|
|
||||||
|
|
||||||
if monitor:
|
|
||||||
monitor.handler.add_ignore_path(
|
|
||||||
real_source,
|
|
||||||
file_size
|
|
||||||
)
|
|
||||||
monitor.handler.add_ignore_path(
|
|
||||||
real_target,
|
|
||||||
file_size
|
|
||||||
)
|
|
||||||
|
|
||||||
shutil.move(real_source, real_target)
|
shutil.move(real_source, real_target)
|
||||||
|
|
||||||
# Move all associated files with the same base name
|
# Move all associated files with the same base name
|
||||||
|
|||||||
Reference in New Issue
Block a user