[IMP] session_redis: add absolute expiration option

ODOO_SESSION_REDIS_EXPIRATION_ABSOLUTE=1 makes authenticated sessions expire
ODOO_SESSION_REDIS_EXPIRATION seconds after the login, whatever the activity.

Default mode: SET … EX instead of SET then EXPIRE, so a failed EXPIRE can no
longer leave a key without TTL. rotate() also resets should_rotate, as
odoo.http.FilesystemSessionStore does.
This commit is contained in:
Vincent Van Rossem committed 2026-09-25 11:03:00 +02:00
1 parent 5108bfe728
commit ff8cd092bd
7 files changed
+186 -5

No files matched your search

+2
View File
@@ -40,6 +40,7 @@ url = os.environ.get("ODOO_SESSION_REDIS_URL")
password = os.environ.get("ODOO_SESSION_REDIS_PASSWORD")
expiration = os.environ.get("ODOO_SESSION_REDIS_EXPIRATION")
anon_expiration = os.environ.get("ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS")
absolute_expiration = is_true(os.environ.get("ODOO_SESSION_REDIS_EXPIRATION_ABSOLUTE"))
@lazy_property
@@ -56,6 +57,7 @@ def session_store(self):
prefix=prefix,
expiration=expiration,
anon_expiration=anon_expiration,
absolute_expiration=absolute_expiration,
session_class=http.Session,
)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.