fix attempt
This commit is contained in:
@@ -96,16 +96,21 @@ class BaseProvider(ABC):
|
||||
print(f"Initialized {name} provider with session-specific config (rate: {actual_rate_limit}/min)")
|
||||
|
||||
def __getstate__(self):
|
||||
"""Prepare BaseProvider for pickling by excluding unpicklable objects."""
|
||||
state = self.__dict__.copy()
|
||||
# Exclude the unpickleable '_local' attribute
|
||||
if '_local' in state:
|
||||
del state['_local']
|
||||
# Exclude the unpickleable '_local' attribute and stop event
|
||||
unpicklable_attrs = ['_local', '_stop_event']
|
||||
for attr in unpicklable_attrs:
|
||||
if attr in state:
|
||||
del state[attr]
|
||||
return state
|
||||
|
||||
def __setstate__(self, state):
|
||||
"""Restore BaseProvider after unpickling by reconstructing threading objects."""
|
||||
self.__dict__.update(state)
|
||||
# Re-initialize the '_local' attribute
|
||||
# Re-initialize the '_local' attribute and stop event
|
||||
self._local = threading.local()
|
||||
self._stop_event = None
|
||||
|
||||
@property
|
||||
def session(self):
|
||||
|
||||
Reference in New Issue
Block a user