|
|
@ -38,6 +38,7 @@ except ImportError: |
|
|
|
|
|
|
|
SESSION_TIMEOUT = 60 * 60 * 24 * 7 |
|
|
|
|
|
|
|
|
|
|
|
def retry_redis(func): |
|
|
|
@functools.wraps(func) |
|
|
|
def wrapper(self, *args, **kwargs): |
|
|
@ -48,8 +49,10 @@ def retry_redis(func): |
|
|
|
_logger.warn("SessionStore connection failed! (%s/5)" % attempts) |
|
|
|
if attempts >= 5: |
|
|
|
raise error |
|
|
|
|
|
|
|
return wrapper |
|
|
|
|
|
|
|
|
|
|
|
class RedisSessionStore(SessionStore): |
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
@ -59,7 +62,9 @@ class RedisSessionStore(SessionStore): |
|
|
|
host=config.get('session_store_host', 'localhost'), |
|
|
|
port=int(config.get('session_store_port', 6379)), |
|
|
|
db=int(config.get('session_store_dbindex', 1)), |
|
|
|
password=config.get('session_store_pass', None) |
|
|
|
password=config.get('session_store_pass', None), |
|
|
|
ssl=config.get("session_store_ssl", False), |
|
|
|
ssl_cert_reqs=config.get("session_store_ssl_cert_reqs", None), |
|
|
|
) |
|
|
|
|
|
|
|
def _encode_session_key(self, key): |
|
|
@ -89,3 +94,4 @@ class RedisSessionStore(SessionStore): |
|
|
|
return self.session_class(pickle.loads(payload), sid, False) |
|
|
|
else: |
|
|
|
return self.session_class({}, sid, False) |
|
|
|
|