mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
Merge branch 'mig-19.0-session_redis' of https://github.com/camptocamp/odoo-cloud-platform into merge-branch-2473-mig-session_redis-19.0-batch-20260612-worker-3-721685ad
# Conflicts: # session_redis/session.py
This commit is contained in:
@@ -176,10 +176,17 @@ class RedisSessionStore(SessionStore):
|
|||||||
identifiers = set(identifiers)
|
identifiers = set(identifiers)
|
||||||
not_found = set()
|
not_found = set()
|
||||||
for partial_sid in identifiers:
|
for partial_sid in identifiers:
|
||||||
key = f"session::{self.prefix}:{partial_sid}*"
|
try:
|
||||||
match = self.redis.keys(pattern=key)
|
next(
|
||||||
if not match:
|
self.redis.scan_iter(
|
||||||
|
match=f"{self.prefix}{partial_sid}*",
|
||||||
|
count=1,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except StopIteration:
|
||||||
|
# No matches found
|
||||||
not_found.add(partial_sid)
|
not_found.add(partial_sid)
|
||||||
|
|
||||||
return not_found
|
return not_found
|
||||||
|
|
||||||
def delete_from_identifiers(self, identifiers: builtins.list[PartialSid]):
|
def delete_from_identifiers(self, identifiers: builtins.list[PartialSid]):
|
||||||
@@ -192,12 +199,12 @@ class RedisSessionStore(SessionStore):
|
|||||||
"""
|
"""
|
||||||
patterns_to_unlink = []
|
patterns_to_unlink = []
|
||||||
for identifier in identifiers:
|
for identifier in identifiers:
|
||||||
# Avoid removing a session if it does not match an identifier. See this same
|
# Avoid removing a session if it does not match an identifier.
|
||||||
# comment in odoo.http.FileSessionStore.delete_from_identifiers.
|
# See this same comment in odoo.http.FileSessionStore.delete_from_identifiers.
|
||||||
if not odoo.http._session_identifier_re.match(identifier):
|
if not odoo.http._session_identifier_re.match(identifier):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Identifier format incorrect, did you pass in a string instead ",
|
"Identifier format incorrect, did you pass in a string instead "
|
||||||
"of a list?",
|
"of a list?"
|
||||||
)
|
)
|
||||||
patterns_to_unlink.append(f"{self.prefix}{identifier}*")
|
patterns_to_unlink.append(f"{self.prefix}{identifier}*")
|
||||||
keys_to_unlink = []
|
keys_to_unlink = []
|
||||||
|
|||||||
Reference in New Issue
Block a user