[FIX] unnecessary rebuilding of assets
The checksum computed to verify the version of the assets includes a list of files as JSON. This JSON is generated from a list of dictionaries. When using Python <3.6, the ordering of the dictionaries is not guaranteed which lead to unnecessary rebuild of assets. Particularly when starting Odoo on more than one host, the current implementation hits this issue: * server 1 computes the checksum with an ordering and generates the assets * server 2 computes the checksum with a different ordering and generates the assets * server 1 computes the checksum with a different ordering and generates the assets * And so on... Which obviously lead to disastrous performances.
This commit is contained in:
committed by
xmo-odoo
parent
b37cc1f9b7
commit
f3bb9ae679
@@ -152,7 +152,7 @@ class AssetsBundle(object):
|
||||
Not really a full checksum.
|
||||
We compute a SHA1 on the rendered bundle + max linked files last_modified date
|
||||
"""
|
||||
check = u"%s%s%s" % (json.dumps(self.files), u",".join(self.remains), self.last_modified)
|
||||
check = u"%s%s%s" % (json.dumps(self.files, sort_keys=True), u",".join(self.remains), self.last_modified)
|
||||
return hashlib.sha1(check.encode('utf-8')).hexdigest()
|
||||
|
||||
def clean_attachments(self, type):
|
||||
|
||||
Reference in New Issue
Block a user