-
- Downloads
[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:
David Monjoie (dmo) <dmo@odoo.com>
Showing
- addons/web_editor/controllers/main.py 25 additions, 2 deletionsaddons/web_editor/controllers/main.py
- addons/web_editor/static/src/js/backend/html_field.js 1 addition, 1 deletionaddons/web_editor/static/src/js/backend/html_field.js
- addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js 1 addition, 1 deletion...editor/static/src/js/editor/odoo-editor/src/OdooEditor.js
- addons/web_editor/static/src/js/editor/odoo-editor/test/spec/collab.test.js 2 additions, 24 deletions...static/src/js/editor/odoo-editor/test/spec/collab.test.js
- addons/web_editor/static/src/js/editor/odoo-editor/test/utils.js 28 additions, 3 deletions...web_editor/static/src/js/editor/odoo-editor/test/utils.js
- addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js 24 additions, 7 deletionsaddons/web_editor/static/src/js/wysiwyg/PeerToPeer.js
- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js 439 additions, 134 deletionsaddons/web_editor/static/src/js/wysiwyg/wysiwyg.js
- addons/web_editor/static/src/xml/editor.xml 1 addition, 1 deletionaddons/web_editor/static/src/xml/editor.xml
- addons/web_editor/static/tests/test_wysiwyg_collaboration.js 788 additions, 0 deletionsaddons/web_editor/static/tests/test_wysiwyg_collaboration.js
Loading
Please register or sign in to comment