Make sure everything is synced before migrating the drive

pull/1/head
yflory 8 years ago
parent 7dd9ed543a
commit 969cec5d60

@ -793,8 +793,7 @@ define([
try { try {
debug("Migrating file system..."); debug("Migrating file system...");
files.migrate = 1; files.migrate = 1;
if (exp.rt) { exp.rt.sync(); } var next = function () {
window.setTimeout(function () {
var oldData = files[OLD_FILES_DATA].slice(); var oldData = files[OLD_FILES_DATA].slice();
if (!files[FILES_DATA]) { if (!files[FILES_DATA]) {
files[FILES_DATA] = {}; files[FILES_DATA] = {};
@ -838,7 +837,13 @@ define([
delete files.migrate; delete files.migrate;
console.log('done'); console.log('done');
todo(); todo();
}, 300); };
if (exp.rt) {
exp.rt.sync();
Cryptpad.whenRealtimeSyncs(exp.rt, next);
} else {
window.setTimeout(next, 1000);
}
} catch(e) { } catch(e) {
console.error(e); console.error(e);
todo(); todo();

Loading…
Cancel
Save