fix session manager
This commit is contained in:
parent
007ebbfd73
commit
8b7a0656bb
@ -33,6 +33,22 @@ class SessionManager:
|
|||||||
|
|
||||||
print(f"SessionManager initialized with Redis backend and {session_timeout_minutes}min timeout")
|
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:
|
def _get_session_key(self, session_id: str) -> str:
|
||||||
"""Generates the Redis key for a session."""
|
"""Generates the Redis key for a session."""
|
||||||
return f"dnsrecon:session:{session_id}"
|
return f"dnsrecon:session:{session_id}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user