diff --git a/core/session_manager.py b/core/session_manager.py index 0fb9b28..d8b74a3 100644 --- a/core/session_manager.py +++ b/core/session_manager.py @@ -33,6 +33,22 @@ class SessionManager: print(f"SessionManager initialized with Redis backend and {session_timeout_minutes}min timeout") + def __getstate__(self): + state = self.__dict__.copy() + # Exclude the unpickleable 'lock' and 'cleanup_thread' attributes + if 'lock' in state: + del state['lock'] + if 'cleanup_thread' in state: + del state['cleanup_thread'] + return state + + def __setstate__(self, state): + self.__dict__.update(state) + # Re-initialize the 'lock' and 'cleanup_thread' attributes + self.lock = threading.Lock() + self.cleanup_thread = threading.Thread(target=self._cleanup_loop, daemon=True) + self.cleanup_thread.start() + def _get_session_key(self, session_id: str) -> str: """Generates the Redis key for a session.""" return f"dnsrecon:session:{session_id}"