Provide a deterministic session garbage collection instead of the default random one
Project description
Whenever a new request is processed by Odoo, this statement is evaluated: random.random() < 0.001 [1]
1 time out of 1000 in average, it will return True and trigger the Garbage Collection of sessions: sessions that have not been active for more than 1 week will be deleted [2]
This random approach can become a problem in some contexts.
On a highly visited Odoo website, many sessions will be created. Going through all of them will take some time, especially on a slow/loaded FS. The Garbage Collection happening randomly, your users will report you cases of Odoo being randomly slow on random actions. They won’t be able to reproduce these cases and you won’t be able to trace them in your odoo logs neither, because calls’ response time doesn’t include the time Odoo spent on the Garbage Collection.
Moreover, on a heavily loaded server, better be in a position to control when does the Garbage Collection happen. One might want to run it once per night only for example.
That’s why we created this module:
to disable the default random Garbage Collection
to enable administrators to replace it by a deterministic approach:
either by using the included Scheduled Action;
or by calling the added public method ir.autovacuum:gc_sessions() remotely
Table of contents
Installation
You need to load this module server-wide:
By starting Odoo with --load=web,base_deterministic_session_gc
Or by updating its configuration file:
[options]
(...)
server_wide_modules = web,base_deterministic_session_gc
You also need to install it in your database if you want to use the provided deterministic approach.
Configuration
You can change the session expiry delay in the Odoo configuration file:
[options]
(...)
; 1 day = 60*60*24 seconds
session_expiry_delay = 86400
Default value is 7 days.
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
Nils Hamerlinck <nils@trobz.com>
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/server-tools project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo12_addon_base_deterministic_session_gc-12.0.1.0.0.99.dev2-py3-none-any.whl
.
File metadata
- Download URL: odoo12_addon_base_deterministic_session_gc-12.0.1.0.0.99.dev2-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/59.1.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2614ad2afd733c84e0c8bdad78d6c47c61fcc2af69d3ab4f2ae59373c0c0002d |
|
MD5 | 1e932c3feecb83670a5caddf950dbb9b |
|
BLAKE2b-256 | d2ffdb3d19de0a3c9015ae5ea6c46f580aa87a13092aba2921d1b3b29a93612c |