From 007ebbfd731c7300fefcad3a5de1664b5630b655 Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Fri, 12 Sep 2025 14:17:11 +0200 Subject: [PATCH] fix for redis --- providers/base_provider.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/providers/base_provider.py b/providers/base_provider.py index f40d9ea..9679f45 100644 --- a/providers/base_provider.py +++ b/providers/base_provider.py @@ -87,6 +87,18 @@ class BaseProvider(ABC): print(f"Initialized {name} provider with session-specific config (rate: {actual_rate_limit}/min)") + def __getstate__(self): + state = self.__dict__.copy() + # Exclude the unpickleable '_local' attribute + if '_local' in state: + del state['_local'] + return state + + def __setstate__(self, state): + self.__dict__.update(state) + # Re-initialize the '_local' attribute + self._local = threading.local() + @property def session(self): if not hasattr(self._local, 'session'):