Files
odoo_source/odoo/addons/base
Nicolas Martinelli 7bbe15bc15 [FIX] base: GC files progressively
- Get a database with millions of files in the checklist (do not ask how
  this happened)
- Set a cron timeout low enough so that `autovacuum_job` times out

The file GC will endlessly timeout without being able to delete any
file.

This is due to how the `_file_gc` method is built: we first build the
whole whitelist, then we perform the deletion. With millions of
checklist files, the loop which builds the `whitelist` takes ages. It
ultimately leads to a timeout of the scheduled action, and therefore no
file is deleted.

To avoid this, we delete the files progressively. The checklist is split
in chunks, and we check which files must be GC'd in a given checklist
chunk. This way the files are removed even in case of timeout, meaning
that there will be less files to check during the next run. Eventually
the GC won't timeout anymore.

closes odoo/odoo#79834

X-original-commit: dbae52479062ace9e2b2d376ec2d601d86482f86
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2021-11-16 12:20:02 +00:00
..
2021-10-05 16:54:21 +00:00
2021-11-16 12:20:02 +00:00