[FIX] website: fix issue when creating account / relogging

When creating an account from the website (through the link "Don't have an
account?") while having been previously identified, the creation lasts a very
long time and ends-up with a http 502 error (actually a timeout). Same when
logging although being already logged.

Technical note: The problem was due to a database deadlock because of going
twice through authentication. A record was deleted in one transaction while
being written in another (_merge_visitor deletes it and _update_visitor_last
visit writes it but with different environment).

Task-2950241

closes odoo/odoo#99723

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Pierre-Yves Dufays
2022-09-16 19:16:59 +02:00
committed by Thibault Delavallée
parent c70984f403
commit e94d65519d
+2 -1
View File
@@ -81,7 +81,8 @@ class ResUsers(models.Model):
if visitor_current_user_sudo:
# A visitor exists for the logged in user, link public
# visitor records to it.
visitor_pre_authenticate_sudo._merge_visitor(visitor_current_user_sudo)
if visitor_pre_authenticate_sudo != visitor_current_user_sudo:
visitor_pre_authenticate_sudo._merge_visitor(visitor_current_user_sudo)
visitor_current_user_sudo._update_visitor_last_visit()
else:
visitor_pre_authenticate_sudo.access_token = user_partner.id