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

[15.0][MIG] endpoint_route_handler #44

Closed
wants to merge 36 commits into from

Conversation

astirpe
Copy link
Member

@astirpe astirpe commented May 19, 2024

No description provided.

simahawk and others added 30 commits May 19, 2024 10:37
When an endpoint is archived it must be dropped.
When it's unarchive it must be restored.
Routing maps are generated **per env**
which means that every new env will have its own routing map
attached to `ir.http` registry class.

This is not desired (as per core Odoo comment)
but it's like this today :/

Hence, before this change, the routing map could be mis-aligned
across different envs leading to random responses for custom endpoints.

This refactoring simplifies a lot the handling of the rules
leaving to std `_generate_routing_rules` the duty to yield rules
and to `routing_map` to generate them for the new route map.

EndpointRegistry memory consumption is improved too
thanks to smaller data to store and to the usage of __slots__.
To avoid multiple invalidation of all envs on each edit or create
of persistent records, a new flag is introduced: 'registry_sync'.

This flag delays the sync of the rule registry till manual action
occurs. Records in the UI are decorated accordingly to notify users of
the need to reflect changes on ther registry to make them effective.

The sync happens in a post commit hook to ensure all values are in place
for the affected records.
Depending on your modules inheritance and upgrade order
when you introduce this mixin on an existing model
it might happen that
gets called before the model's table is ready
(eg: another odoo service loading the env before the upgrade happens).
Let if fail gracefully since the hook will be called again later.
As routes are registered automatically in the db after sync
there's no reason to look for non registered routes at boot.
Furthermore, this is causing access conflicts on the table
when multiple instances w/ multiple workers are spawned.
@astirpe astirpe force-pushed the 15_mig_endpoint_route_handler branch from b162250 to 7aa46a0 Compare May 19, 2024 08:53
@astirpe astirpe marked this pull request as ready for review May 19, 2024 08:55
@astirpe astirpe force-pushed the 15_mig_endpoint_route_handler branch from 7aa46a0 to 5347d6d Compare May 19, 2024 09:05
Copy link

@CasVissers-360ERP CasVissers-360ERP left a comment

Choose a reason for hiding this comment

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

Functional review

Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

LG

@simahawk
Copy link
Contributor

simahawk commented Jul 1, 2024

/ocabot migration endpoint_route_handler

@OCA-git-bot OCA-git-bot added this to the 15.0 milestone Jul 1, 2024
@OCA-git-bot
Copy link
Contributor

There's no issue in this repo with the title 'Migration to version 15.0' and the milestone 15.0, so not possible to add the comment.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@simahawk
Copy link
Contributor

simahawk commented Jul 4, 2024

@astirpe I forgot to mention that there's a fix in v14 for some edge cases #37
I'll fwd port for v16, can you take care for v15? You can update this PR if you prefer 😉

Copy link

github-actions bot commented Nov 3, 2024

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Nov 3, 2024
@github-actions github-actions bot closed this Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved ready to merge stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants