[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.
This commit is contained in:
Olivier Dony
2016-12-02 12:25:16 +01:00
parent 12e36a66f2
commit 8a7af44a07
@@ -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):