From 969cec5d60ccc78d538f28557536306bfbd99d7c Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 12 Jun 2017 16:19:45 +0200 Subject: [PATCH] Make sure everything is synced before migrating the drive --- www/common/userObject.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/www/common/userObject.js b/www/common/userObject.js index 666d1e053..f17e3838b 100644 --- a/www/common/userObject.js +++ b/www/common/userObject.js @@ -793,8 +793,7 @@ define([ try { debug("Migrating file system..."); files.migrate = 1; - if (exp.rt) { exp.rt.sync(); } - window.setTimeout(function () { + var next = function () { var oldData = files[OLD_FILES_DATA].slice(); if (!files[FILES_DATA]) { files[FILES_DATA] = {}; @@ -838,7 +837,13 @@ define([ delete files.migrate; console.log('done'); todo(); - }, 300); + }; + if (exp.rt) { + exp.rt.sync(); + Cryptpad.whenRealtimeSyncs(exp.rt, next); + } else { + window.setTimeout(next, 1000); + } } catch(e) { console.error(e); todo();