Skip to content
Snippets Groups Projects
Commit c5d3a109 authored by Julien Castiaux's avatar Julien Castiaux Committed by Raphael Collet
Browse files

[REF] ir.autovacuum: declarative garbage collector registration


The ir.autovacuum model purpose is to run several garbage collecting
operations like removing files from the filestore when no attachment
references them anymore.

The precedent strategy to register new garbage collection tasks was to
override the `power_on` method and to imperatively execute a vacuum
cleaning method on a given model. All calls were executed in a single
SQL transaction without any error handling, meaning a single fail during
any call resulted in a complete failure of the entire vacuum cleaning
chain.

We introduce a new `@autovacuum` api decorator, its purpose it to
register garbage collecting methods that will be safely executed in
their own transaction by the vacuum cleaner. In order to ensure this
new strategy is used, we deprecate `power_on` extensions.

By the way, garbage-collecting methods can be quite heavy and we don't
want users to directly call them. We now ensure they are private.

closes odoo/odoo#47842

Task: 2154079
Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
Co-authored-by: default avatarRaphael Collet <rco@odoo.com>
Co-authored-by: default avatarOlivier Dony <odo@odoo.com>
parent 64873d22
No related branches found
No related tags found
No related merge requests found
Showing
with 40 additions and 117 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment