mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
Remove lock usage entirely to fix pickling issues
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
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 typing import Dict, List, Optional, Union
|
from typing import Dict, List, Optional, Union
|
||||||
@@ -30,7 +29,6 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
_logger: Logger = Logger(verbose=True)
|
_logger: Logger = Logger(verbose=True)
|
||||||
_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,
|
||||||
@@ -161,12 +159,9 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC):
|
|||||||
previously recorded timestamps to detect changes. When a file has been modified,
|
previously recorded timestamps to detect changes. When a file has been modified,
|
||||||
it logs the change and returns True to trigger a reload.
|
it logs the change and returns True to trigger a reload.
|
||||||
|
|
||||||
Thread-safe: Uses a lock to prevent concurrent modifications.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if any file has been modified, False otherwise.
|
bool: True if any file has been modified, False otherwise.
|
||||||
"""
|
"""
|
||||||
with self._lock:
|
|
||||||
for path in self.safe_file_paths:
|
for path in self.safe_file_paths:
|
||||||
try:
|
try:
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
|
|||||||
Reference in New Issue
Block a user