[FIX] website: change the asset disabling from GC to CRON
Before this commit, the behavior disabling the unused snippet assets was put directly in the autovacuum CRON instead of its own CRON. That behavior is leading to some perf-issue running the autovacuum cron since it would take too much time. Indeed, the code will loop inside as many snippet as it exists, and every time then perform an SQL Query to get the HTML fields using the snippet. An improvement will come later to not loop on every snippet anymore. task-2694120 closes odoo/odoo#79981 X-original-commit: 96ab95d37c9b442a4ccb737fd867ca91ec1c11b6 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
'security/website_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'data/ir_asset.xml',
|
||||
'data/ir_cron_data.xml',
|
||||
'data/mail_mail_data.xml',
|
||||
'data/website_data.xml',
|
||||
'data/website_visitor_cron.xml',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="website_disable_unused_snippets_assets" model="ir.cron">
|
||||
<field name="name">Disable unused snippets assets</field>
|
||||
<field name="model_id" ref="model_website"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model._disable_unused_snippets_assets()</field>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">weeks</field>
|
||||
<field name="numbercall">-1</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1424,7 +1424,6 @@ class Website(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
@api.autovacuum
|
||||
def _disable_unused_snippets_assets(self):
|
||||
snippets_assets = self._get_snippets_assets()
|
||||
html_fields = self._get_html_fields()
|
||||
|
||||
Reference in New Issue
Block a user