Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][ADD] web_assets_warmup #2614

Merged
merged 2 commits into from
Jan 12, 2024
Merged

Conversation

jbaudoux
Copy link

@jbaudoux jbaudoux commented Sep 15, 2023

Ensure that assets are generated and stored in the DB when Odoo starts

If the assets from the database are not up-to-date, they are regenerated by
Odoo when we print a report, but to do so Odoo forces the commit, so if an
exception occurs after (or during) the report rendering, it let the database in
a broken state (picking have been validated in this case).

To prevent this issue, we need to ensure that the assets are well-generated
when Odoo starts, not when the report is printed.

cc @sebalix @mt-software-de

@jbaudoux jbaudoux changed the title [ADD] web_generate_assets [14.0][ADD] web_generate_assets Sep 15, 2023
@simahawk
Copy link
Contributor

FTR I'm not sure if the name is really explicative. Something like web_assets_warmup might be more appropriated. Not a blocker tho.

Copy link

@mt-software-de mt-software-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we could have dedicated services for web and cronjobs. We should add a lock. Otherwise we can get a "serialize access" error.

camptocamp#3

@rvalyi
Copy link
Member

rvalyi commented Oct 13, 2023

FTR I'm not sure if the name is really explicative. Something like web_assets_warmup might be more appropriated. Not a blocker tho.

+1 for web_assets_warmup

@jbaudoux
Copy link
Author

web_generate_assets_initially ?

@rvalyi
Copy link
Member

rvalyi commented Oct 13, 2023

web_generate_assets_initially ?

asset "cache warmup" is really the technical term web developers would expect in a web framework IMHO. See for instance https://www.google.com/search?client=ubuntu-chr&hs=mW0&sca_esv=573172220&q=web+asset+cache+%22warmup%22+rails&oq=web+asset+cache+%22warmup%22+rails&aqs=heirloom-srp..

@pedrobaeza
Copy link
Member

@bofiltd putting a lot of reviews in few minutes in the corresponding PRs is not trustful and can't be taken as a serious review, so please abstain for doing that.

jbaudoux and others added 2 commits January 12, 2024 00:53
With dedicated services for odoo web and odoo cron
we can get a serialize access error on startup
@jbaudoux jbaudoux changed the title [14.0][ADD] web_generate_assets [14.0][ADD] web_assets_warmup Jan 11, 2024
@jbaudoux
Copy link
Author

Module renamed to web_assets_warmup

"""Plan the next execution of the cron responsible to generate assets."""
if os.environ.get("RUNNING_ENV") == "dev":
return
dbname = os.environ.get("DB_NAME")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DB_NAME is not a core odoo var. The db name should be take from config.
Not blocking, you can fix this later as this one is waiting since quite some time.

@simahawk
Copy link
Contributor

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-2614-by-simahawk-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 79d66cd into OCA:14.0 Jan 12, 2024
7 of 9 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at f10d729. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants