From 66dc166936dfc10ce2234f72499998bccc5ee7a4 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 27 Feb 2017 14:28:12 +0100 Subject: [PATCH] Make sure the realtime is synced with onSettle when using cryptget --- www/common/cryptget.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/www/common/cryptget.js b/www/common/cryptget.js index d74bcee1d..80feacec0 100644 --- a/www/common/cryptget.js +++ b/www/common/cryptget.js @@ -70,10 +70,16 @@ define([ TextPatcher.create({ realtime: realtime, })(doc); - realtime.sync(); - realtime.abort(); - finish(Session, void 0); + var to = window.setTimeout(function () { + cb(new Error("Timeout")); + }, 5000); + + Cryptpad.whenRealtimeSyncs(realtime, function () { + window.clearTimeout(to); + realtime.abort(); + finish(Session, void 0); + }); }; overwrite(config, opt);