Replace RLock with threading.Lock to fix pickling issues

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-06 00:19:24 +00:00
parent 72df165b07
commit 171f8b63fd

View File

@@ -1,7 +1,7 @@
import os import os
import threading
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from pathlib import Path from pathlib import Path
from threading import RLock
from typing import Dict, List, Optional, Union from typing import Dict, List, Optional, Union
from pydantic import Field, field_validator from pydantic import Field, field_validator
@@ -30,7 +30,7 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC):
""" """
_logger: Logger = Logger(verbose=True) _logger: Logger = Logger(verbose=True)
_lock = RLock() # Thread-safe lock for file operations _lock = threading.Lock() # Thread-safe lock for file operations
file_path: Optional[Union[Path, List[Path], str, List[str]]] = Field( file_path: Optional[Union[Path, List[Path], str, List[str]]] = Field(
default=None, default=None,