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
auto_awesome What this module does
AI-generated from the code · Odoo 14.0Replaces Odoo's random session cleanup with a scheduled, predictable one. Sessions inactive for more than a week are deleted by a recurring job instead of at random moments.
By default Odoo occasionally deletes old user sessions at random moments, which can make the system feel slow without warning. This module changes that behaviour so the cleanup happens on a fixed schedule instead.
- A scheduled action named "Garbage collection of expired sessions" runs every hour and removes sessions that have been inactive for more than one week (the delay can be configured).
- The cleanup is performed by a method on the
ir.autovacuummodel, and only an administrator is allowed to run it, so it cannot be triggered by ordinary users. - Because the job runs on a timer rather than randomly during normal requests, users should no longer experience unexplained slowdowns caused by session cleanup.
- The module depends on
mailand adds no new menus or screens; it works in the background and is managed through the standard scheduled actions list.
In short, it gives administrators control over when old sessions are removed, making Odoo's performance more consistent.
Depends on
Models and fields (1)
- ir.autovacuum · extends an existing model
Text generated by AI (DeepSeek) from reading the Odoo 14.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 3 confirmed, 6 with no information of 9 versions.
Sources · Odoo 13.0
Confirmed on 2026-11-03 in branch 13.0 of OCA/server-tools.
terminal Installation and usage
OCA documentation · Odoo 14.0Installation
Source · Odoo 14.0You 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_gcYou also need to install it in your database if you want to use the provided deterministic approach.
Configuration
Source · Odoo 14.0You can change the session expiry delay in the Odoo configuration file:
[options]
(...)
; 1 day = 60*60*24 seconds
session_expiry_delay = 86400Default value is 7 days.
No verified information in OCA: Usage.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.