Skip to content
Snippets Groups Projects
Commit 37836c0a authored by Nicolas Bayet's avatar Nicolas Bayet
Browse files

[FIX] web_editor: strengthen collab stale detection & recovery


Before this commit, the stale document detection was imprecise and
incomplete.

The stale document could happen in different scenario:
1)  Client B save when client A is disconnected (therefore client A
    should be notified that the document is stale upon reconnection):

    - For that scenario, the code had a heuristic to detect if the
    internet connection disconnected and reconnected but was imprecise
    as the browser api is not 100% reliable on all browser and
    platforms. That made the code under-checking or over-checking with
    the server.

2)  The user has not yet focused on the element and before this
    commit, the stale document was not detected.

3) If there is a partition in the peer to peer network and a member of
   another partition that save, all other partition will not be aware
   that they are working on a stale document.

4) The stale document happen before 2 peers could be fully connected.

For any of those scenarios, if a stale document was not detected and
the user tried to save changes, only then, a popup would inform that
the version was stale. And if the user closed the tab thinking the
document would automatically save, the change would not be saved
(without warning).

This commit:
1) improve detection of stale document
To detect the document this commit add a message in the odoo bus.bus
for the channel of the record for each write. That will ensure the
message to be received as soon as a user is connected to odoo.

2) improve recovery from stale document
Before this commit, the recovery was only made from the server.

As a detection is now direct (rather than delayed by the previous
heuristic), a document could be detected stale before receiving a step
that would not make it stale. Therefore, we cannot just reset from the
server as a recovery mechanism.

To recover, this commit first tries to reset from missing steps from
all peers. If unsuccessful, it will tries to reset from a snapshot. If
unsuccessful, it will reset from the server.

3) add a mechanism for aborting requests
To prevent unexpected concurrency behavior, this commit add a mechanism
to abort requests.

4) a framework for testing the collaboration of the wysiwyg
As it could be quite tedious and error prone to manually tests
concurrency issues related to the wysiwyg, this commit add a framework
for testing the collaboration of the wysiwyg and test the detection
and recovery of stale document.

task-3217965

closes odoo/odoo#128847

Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
parent 115393d5
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment