diff --git a/endpoint_route_handler/models/ir_http.py b/endpoint_route_handler/models/ir_http.py index fae37027..0cfa3ae8 100644 --- a/endpoint_route_handler/models/ir_http.py +++ b/endpoint_route_handler/models/ir_http.py @@ -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( @@ -71,6 +72,10 @@ def routing_map(cls, key=None): cls._routing_map = {} cls._rewrite_len = {} cls._endpoint_route_last_version = last_version + finally: + cr.rollback() + cr.close() + return super().routing_map(key=key) @classmethod