diff --git a/py/services/file_monitor.py b/py/services/file_monitor.py index 849ba2a0..12a76120 100644 --- a/py/services/file_monitor.py +++ b/py/services/file_monitor.py @@ -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 diff --git a/py/workflow/mappers.py b/py/workflow/mappers.py index 0cdf0e0a..2f661521 100644 --- a/py/workflow/mappers.py +++ b/py/workflow/mappers.py @@ -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