mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
Refactor LoraFileHandler to use provided event loop and improve logging
- Updated LoraFileHandler to utilize the passed event loop for time retrieval instead of the current thread's event loop. - Changed error logging for extension loading in mappers from error to warning level for better clarity.
This commit is contained in:
@@ -32,7 +32,8 @@ class LoraFileHandler(FileSystemEventHandler):
|
||||
# Also check with backslashes for Windows compatibility
|
||||
alt_path = real_path.replace('/', '\\')
|
||||
|
||||
current_time = asyncio.get_event_loop().time()
|
||||
# 使用传入的事件循环而不是尝试获取当前线程的事件循环
|
||||
current_time = self.loop.time()
|
||||
|
||||
# Check if path is in ignore list and not expired
|
||||
if normalized_path in self._ignore_paths and self._ignore_paths[normalized_path] > current_time:
|
||||
@@ -59,8 +60,7 @@ class LoraFileHandler(FileSystemEventHandler):
|
||||
else:
|
||||
timeout = self._min_ignore_timeout
|
||||
|
||||
# Store expiration time instead of just the path
|
||||
current_time = asyncio.get_event_loop().time()
|
||||
current_time = self.loop.time()
|
||||
expiration_time = current_time + timeout
|
||||
|
||||
# Store both normalized and alternative path formats
|
||||
@@ -72,8 +72,7 @@ class LoraFileHandler(FileSystemEventHandler):
|
||||
|
||||
logger.debug(f"Added ignore path: {normalized_path} (expires in {timeout:.1f}s)")
|
||||
|
||||
# Schedule cleanup after timeout
|
||||
asyncio.get_event_loop().call_later(
|
||||
self.loop.call_later(
|
||||
timeout,
|
||||
self._remove_ignore_path,
|
||||
normalized_path
|
||||
|
||||
@@ -421,7 +421,7 @@ def load_extensions(ext_dir: str = None) -> None:
|
||||
logger.info(f"Loaded extension mapper: {mapper.node_type} from {filename}")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error loading extension {filename}: {e}")
|
||||
logger.warning(f"Error loading extension {filename}: {e}")
|
||||
|
||||
|
||||
# Initialize the registry with default mappers
|
||||
|
||||
Reference in New Issue
Block a user