From 8a7af44a07571d3aa53721d1cf9a53ff4d923fa8 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 2 Dec 2016 11:51:26 +0100 Subject: [PATCH] [FIX] ir.qweb: force multi-worker bundle invalidation When a newly-spawned worker detects a stale asset bundle (due to its empty cache), it regenerates the new bundles, but has to notify other workers, who would otherwise continue serving the old list of bundles. This typically leads to some missing bundles (served as empty files with 404 status), that could only be cured by restarting the whole server. Forcing the cache invalidation on the worker that notices the staleness has no effect (the cache was empty) except that it causes a cache refresh signal to be broadcast to all workers. --- odoo/addons/base/ir/ir_qweb/assetsbundle.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/odoo/addons/base/ir/ir_qweb/assetsbundle.py b/odoo/addons/base/ir/ir_qweb/assetsbundle.py index 7c230d8eaf5..18f8ceec0c4 100644 --- a/odoo/addons/base/ir/ir_qweb/assetsbundle.py +++ b/odoo/addons/base/ir/ir_qweb/assetsbundle.py @@ -173,6 +173,10 @@ class AssetsBundle(object): ('url', '=like', '/web/content/%-%/{0}%.{1}'.format(self.name, type)), # The wilcards are id, version and pagination number (if any) '!', ('url', '=like', '/web/content/%-{}/%'.format(self.version)) ] + + # force bundle invalidation on other workers + self.env['ir.qweb']._get_asset.clear_cache(self.env['ir.qweb']) + return ira.sudo().search(domain).unlink() def get_attachments(self, type):