fix for redis
This commit is contained in:
		
							parent
							
								
									3ecfca95e6
								
							
						
					
					
						commit
						007ebbfd73
					
				@ -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'):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user