Commit [1] and [2] introduced an assets pregeneration to speed up the testing suite on runbot. It seems like it was chosen to always pregenerate the assets when a module was installed/upgraded. This was done in the `test_assetsbundle` module to only impact the tests flows, but it was not correct as it was not only impacting the tests flows but also regular runbot usage. Indeed, any `all` runbot (the default one) will have that module installed. It means that any module operation through regular flow in those DB will trigger the assets pregeneration. One of the problem is then that during a theme switch through the website builder (or configurator), assets would be pregenerated, adding ~40 seconds to the processing time. Since that theme install was already taking ~30 seconds on `all` runbot, it sometimes now total over 60 seconds, triggering the `CPU Time Limit`. You can find some benchmark and metrics on this commit PR. Obviously, that's not fine because runbot, despite being our testing tool/platform, is also one of our main demo tool. That's especially true around the OXP period, where people are recording video on it but will also use it to show demo to the customers. Finally, there is no reason to not limit this assets pregeneration to the test mode anyway. Note that sometimes, the theme install is failing and responding with a 502 error after a long time, this is yet unsure if this was the cause but it was during this investigation that this commit fix was found. It is probably the cause though. [1]: https://github.com/odoo/odoo/commit/c764c38d7caf300dce7509e87d2bd268eee0161d [2]: https://github.com/odoo/odoo/commit/d47cf37b688117d6b2514b9b620787aa66312c61 closes odoo/odoo#103105 X-original-commit: 5e77961e4768ef2d3d40f1600dd76a633a0e231b Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: Xavier-Do <xdo@odoo.com>
17 lines
575 B
Python
17 lines
575 B
Python
from odoo import models
|
|
from odoo.tools import config
|
|
init = config['init']
|
|
|
|
|
|
class IrQweb(models.AbstractModel):
|
|
_inherit = 'ir.qweb'
|
|
|
|
def _register_hook(self):
|
|
super()._register_hook()
|
|
# if this module is installed, we are in a test environement, this is
|
|
# especially true on runbot where all modules are installed.
|
|
# pregenerate assets at the end of the loading to speedup tests
|
|
registry = self.env.registry
|
|
if init and registry.updated_modules and not registry.ready:
|
|
self._pregenerate_assets_bundles()
|