From 0452b53ce3c596e96e116305070ec596457586ab Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 23 Mar 2021 11:14:10 +0000 Subject: [PATCH] Merge pull request #3802 from overleaf/bg-increase-flush-delay increase single and multi-user flush delays GitOrigin-RevId: c9415a093d08c8f6cc403d0ddb6cd313ea99aebe --- services/web/frontend/js/ide/editor/ShareJsDoc.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/web/frontend/js/ide/editor/ShareJsDoc.js b/services/web/frontend/js/ide/editor/ShareJsDoc.js index ed0fc75f81..63bbb3ac7f 100644 --- a/services/web/frontend/js/ide/editor/ShareJsDoc.js +++ b/services/web/frontend/js/ide/editor/ShareJsDoc.js @@ -21,7 +21,8 @@ import ShareJs from 'libs/sharejs' import EditorWatchdogManager from '../connection/EditorWatchdogManager' let ShareJsDoc -const SINGLE_USER_FLUSH_DELAY = 1000 // ms +const SINGLE_USER_FLUSH_DELAY = 2000 // ms +const MULTI_USER_FLUSH_DELAY = 500 // ms export default ShareJsDoc = (function() { ShareJsDoc = class ShareJsDoc extends EventEmitter { @@ -106,8 +107,8 @@ export default ShareJsDoc = (function() { }) this._doc.on('remoteop', (...args) => { // As soon as we're working with a collaborator, start sending - // ops as quickly as possible for low latency. - this._doc.setFlushDelay(0) + // ops more frequently for low latency. + this._doc.setFlushDelay(MULTI_USER_FLUSH_DELAY) return this.trigger('remoteop', ...Array.from(args)) }) this._doc.on('flipped_pending_to_inflight', () => {