52 Commits

Author SHA1 Message Date
Alexandre Fayolle 911fa5535a [PERF] fix performance hit
On the cloud platform of Camptocamp, a shared redis is used to store the
sessions of the different projects -> the number of keys is huge, and
using an iterative match kills the performance because of the networking
overhead.

We switch to using redis.key(pattern), and since the pattern typically
has a leading string which will allow redis to find the correct bucket,
the performance should be good.
2026-02-16 11:42:39 +01:00
Denis Leemann 7375585a5b Update session_redis/session.py
Co-authored-by: Florent Xicluna <142113+florentx@users.noreply.github.com>
2025-12-15 16:00:21 +01:00
Denis Leemann 9dcbe33366 run pre-commit 2025-12-15 15:34:26 +01:00
vrenaville 90f87c263f fix: enable module for 19.0 2025-12-15 15:14:52 +01:00
nbessi 80af680aae fix: Ensure anonymous session timeout is applied when expiration is not an integer or is zero. 2025-11-26 11:40:01 +01:00
Atte Isopuro 750bc4dcf8 [MIG] session_redis: Migration to 19.0 (#499)
* lazy_property is deprecated
* Since https://github.com/odoo/odoo/commit/cea66be976c6d0746a972da8a16b7a239d12a462, Session
  must be used as a dictionary when setting custom values
* Session default lifetime is now defined in odoo.http, so we can just reuse that
* Handle new session rotation logic (sessions must be findable by the first 42 chars of they key)
* Handle new session key generation for rotation (keys must be longer than 42 chars to handle devices)
2025-11-24 15:37:51 +01:00
cyrilmanuel 5d921db4bc Fix template copier answer error 2025-10-02 13:58:15 +02:00
vrenaville c44393ec64 19.0: initial commit 2025-09-23 15:58:10 +02:00
Florent Xicluna 06db90b42a Run pre-commit 2025-05-15 11:51:07 +02:00
Vincent Renaville e529e00fd7 feat: add ssl mode with non url connection + add redis cluster support (#494) 2025-05-12 09:45:42 +02:00
SilvioC2C 64b1240023 [FIX] session_redis: add incompatibility to auth_session_timeout
``session_redis`` is not compatible with ``auth_session_timeout``.
``session_redis`` overrides property ``odoo.http.Application.session_store`` by returning a ``RedisSessionStore`` object instead of a ``odoo.http.FilesystemSessionStore`` object.
``auth_session_timeout`` expects ``odoo.http.Application.session_store`` object to define method ``get_session_filename()``, which does not exist for ``RedisSessionStore`` objects.
This results in an ``AttributeError`` that prevents user authentication, and Odoo becomes inaccessible.
2025-05-08 11:13:47 +02:00
Patrick Tombez 27879b5f79 [MIG] session_redis: Migration to 18.0 2025-02-04 14:24:51 +01:00
vrenaville da9918aee0 feat: add 18.0 sessions_redis migration 2024-11-15 10:36:13 +01:00
Fai 23724e9f69 Add arguments to session vacuum method
`Session.vacuum` method contains extra arguments since this PR https://github.com/odoo/odoo/pull/122888

accept parameters to adapter this change
2024-07-17 14:51:56 +02:00
Alexandre Fayolle 61d30ef6ff run pre-commit 2024-06-24 11:58:48 +02:00
vrenaville 25c7d71eb4 feat: init commit for version 17.0 2023-10-31 14:11:21 +01:00
Yannick Payot d17d229b13 Change CI to GitHub actions
Use copier template from oca/oca-addons-repo-template

Apply linting
2023-05-24 18:22:55 +02:00
Vincent Renaville 988d4906bf [MIG] session_redis: Migration to 16.0 (#392)
Co-authored-by: Hugo Santos <hugo.santos@factorlibre.com>
2022-11-09 13:39:53 +01:00
Vincent Renaville dddd130e79 fix: dependencies and deprecated code (#390) 2022-11-04 14:34:29 +01:00
Vincent Renaville 14cab08024 fix: modifition setup (#386) 2022-09-26 11:31:17 +02:00
vrenaville afc02b779f feat: v16.0 : all modules uninstallable 2022-09-26 10:12:15 +02:00
Daniel Reis a94b4ce9d0 [FIX] session_redis: 'werkzeug.contrib.sessions' is deprecated as of version 0.15 2022-06-08 07:58:52 +01:00
Denis Leemann a8b4b251ef Update manifest files to be consistent inbetween them
The main goal is to be able to easily do grep and sed when we
do mass update on them
2021-10-18 13:08:30 +02:00
Denis Leemann e03fadfd21 15.0 Modules migration 2021-10-18 13:08:30 +02:00
Patrick Tombez 4897d853a0 [MIG] session_redis: Migration to 14.0 2020-11-03 15:40:07 +01:00
Denis Leemann 287332576a Set module for 14.0 uninstallable 2020-10-06 10:54:24 +02:00
Guewen Baconnier 787a64178f Merge pull request #183 from avoinsystems/13.0-redis-by-url
[13.0][IMP] session_redis: allow configuring Redis URL instead of host & port.
2020-05-28 20:45:56 +02:00
Miku Laitinen a383b45f57 [IMP] session_redis: allow configuring Redis URL instead of host & port. 2020-05-14 18:16:55 +03:00
Guewen Baconnier ac89e923d7 Add (de-)serialization of set objects in sessions 2020-05-11 07:35:05 +02:00
Guewen Baconnier 35fb727d6c Encode/decode date and datetime in redis sessions
In several places, odoo sets a datetime object directly in the
session. It works with the default session handler of odoo which
uses pickle.

But datetime and date are not json serializable by default.

Add custom encoder / decoder to handle them (from
https://github.com/OCA/queue/blob/dc12a6a20ecfd15c5b90f9b089c9a64cf9d8bbe4/queue_job/fields.py#L57-L99)

See the discussion raised by @PCatinean on https://github.com/camptocamp/odoo-cloud-platform/pull/176
2020-05-04 16:09:55 +02:00
Patrick Tombez 5fcef3926f Add anonymous redis session expiration configuration 2020-01-27 15:56:22 +01:00
Tonow-c2c e9add2fa96 BSRD-286: MIG V13 session_redis 2019-10-08 17:19:13 +02:00
Tonow-c2c cbff157fdd BSRD-286: Set the addons to uninstallable 2019-10-07 12:16:06 +02:00
jcoux 5c43e3547e fixup! Migration to 12.0 2018-11-23 09:31:46 +01:00
jcoux 7eac1013eb Migration to 12.0 2018-10-24 12:44:45 +02:00
jcoux 73293a1390 Set all modules to uninstallable 2018-10-24 11:53:27 +02:00
Guewen Baconnier 543a9eb22d Fix order of args in logs 2018-03-13 15:00:26 +01:00
Guewen Baconnier 39e71ff334 Expire sessions generated by health checks quickly
The default expiration of sessions is 7 days. With healthchecks run
every few seconds, we quickly have millions of anonymous sessions in
Redis. Allow to define a custom expiration for some sessions and set a
very short one for the monitoring requests.
2018-01-11 10:46:55 +01:00
Yannick Vaucher a3abfca6c5 Don't try to decode None when key was removed from database 2018-01-11 10:41:26 +01:00
Guewen Baconnier 6cc18007dd Remove web_kanban, does no longer exist in 11.0 2018-01-11 10:41:26 +01:00
Guewen Baconnier 207cd6504c Encode/decode redis data which expects bytes 2017-11-15 16:25:02 +01:00
Guewen Baconnier ea44b4fd15 Remove call to encode, str expected, not bytes (py3) 2017-11-15 16:15:39 +01:00
Guewen Baconnier b084ce278a Set addons installable 2017-11-15 14:56:45 +01:00
Guewen Baconnier f9c290a45a Apply 2to3 automatic migration 2017-11-15 14:55:11 +01:00
Guewen Baconnier 96c9a38150 Set addons uninstallable 2017-11-15 14:31:23 +01:00
Guewen Baconnier c7240e1fe1 Allow to use a Redis Sentinel 2017-05-16 09:07:59 +02:00
Guewen Baconnier 8e4b461c75 Migrate addons to 10.0 2016-12-21 21:29:09 +01:00
Guewen Baconnier 022f9003e8 Add debug logs in session_redis 2016-12-14 11:25:12 +01:00
Guewen Baconnier 92880deeab Explicit session_redis must be started in --load 2016-11-10 16:14:19 +01:00
Guewen Baconnier 3c8b74369b Make pylint happy 2016-11-03 16:58:36 +01:00