mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
[MIG] session_redis: Migration to 16.0 (#392)
Co-authored-by: Hugo Santos <hugo.santos@factorlibre.com>
This commit is contained in:
co-authored by
GitHub
Hugo Santos
parent
dddd130e79
commit
988d4906bf
@@ -4,6 +4,7 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
from odoo.service import security
|
||||
from odoo.tools._vendor.sessions import SessionStore
|
||||
|
||||
from . import json_encoding
|
||||
@@ -96,3 +97,18 @@ class RedisSessionStore(SessionStore):
|
||||
keys = self.redis.keys('%s*' % self.prefix)
|
||||
_logger.debug("a listing redis keys has been called")
|
||||
return [key[len(self.prefix):] for key in keys]
|
||||
|
||||
def rotate(self, session, env):
|
||||
self.delete(session)
|
||||
session.sid = self.generate_key()
|
||||
if session.uid and env:
|
||||
session.session_token = security.compute_session_token(session, env)
|
||||
self.save(session)
|
||||
|
||||
def vacuum(self):
|
||||
""" Do not garbage collect the sessions
|
||||
|
||||
Redis keys are automatically cleaned at the end of their
|
||||
expiration.
|
||||
"""
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user