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

[FIX] endpoint_route_handler: Rollback dedicated routing cursor #77

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion endpoint_route_handler/models/ir_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def routing_map(cls, key=None):
# which will in turn use the updated value of the oauth token to compute
# the session token, and the security check will not fail.
registry = registry_get(http.request.env.cr.dbname)
with registry.cursor() as cr:
cr = registry.cursor()
try:
last_version = cls._get_routing_map_last_version(cr)
if not hasattr(cls, "_routing_map"):
_logger.debug(
Expand All @@ -71,6 +72,13 @@ def routing_map(cls, key=None):
cls._routing_map = {}
cls._rewrite_len = {}
cls._endpoint_route_last_version = last_version
finally:
# No commit is needed here as nothing should be modified since
# this cursor is only here to read the last version of the routing
# map in a different cursor than the request one, see above comment.
cr.rollback()
paradoxxxzero marked this conversation as resolved.
Show resolved Hide resolved
cr.close()

return super().routing_map(key=key)

@classmethod
Expand Down
Loading