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

[17.0][FIX] auditlog: registry propagation #3088

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

gurneyalex
Copy link
Member

When a new auditlog rule is added / modified / deleted, all workers need to be notified of the change. This is done through registry signaling. The previous code was not using the proper level of signaling resulting in workers not being aware of the changes and not implementing the correct auditlog rules, because they had only invalidated their cache and not reloaded the registry.

We fix this by using the same signaling as implemented in base_automation which sets the the registry_invalidated field of env.registry to True to cause a full registry reload.

@gurneyalex gurneyalex changed the title [FIX] auditlog: registry propagation [17.0][FIX] auditlog: registry propagation Oct 22, 2024
@gurneyalex gurneyalex added this to the 17.0 milestone Oct 22, 2024
When a new auditlog rule is added / modified / deleted, all workers
need to be notified of the change. This is done through registry
signaling. The previous code was not using the proper level of signaling
resulting in workers not being aware of the changes and not implementing
the correct auditlog rules, because they had only invalidated their
cache and not reloaded the registry.

We fix this by using the same signaling as implemented in
`base_automation` which sets the the registry_invalidated field of
env.registry to True to cause a full registry reload.
@gurneyalex gurneyalex force-pushed the auditlog-fix-registry-propagation branch from b7cb436 to 56d1a1e Compare October 22, 2024 06:34
auditlog/models/rule.py Outdated Show resolved Hide resolved
@gurneyalex gurneyalex force-pushed the auditlog-fix-registry-propagation branch from 20356ba to 5d2afc0 Compare October 22, 2024 06:53
# this code comes from `base_automation` which has a similar need
if self.env.registry.ready and not self.env.context.get("import_file"):
# notify other workers
self.env.registry.registry_invalidated = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it something compatible on Odoo < 17.0 that should be backported?

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems at least compatible with Odoo 16.0, didn't checked previous versions.

@sebalix
Copy link
Contributor

sebalix commented Oct 23, 2024

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 17.0-ocabot-merge-pr-3088-by-sebalix-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 94d1f29 into OCA:17.0 Oct 23, 2024
7 of 9 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at b26d775. 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.

6 participants