1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Fixed sync init

This commit is contained in:
Laurent Cozic
2017-08-01 18:14:47 +00:00
parent cc54e32823
commit 9ea95e8742

View File

@@ -7,6 +7,7 @@ import { Database } from 'lib/database.js';
import { Synchronizer } from 'lib/synchronizer.js';
import { FileApiDriverOneDrive } from 'lib/file-api-driver-onedrive.js';
import { shim } from 'lib/shim.js';
import { time } from 'lib/time-utils.js';
import { FileApiDriverMemory } from 'lib/file-api-driver-memory.js';
import { PoorManIntervals } from 'lib/poor-man-intervals.js';
@@ -107,14 +108,24 @@ reg.synchronizer = async (syncTargetId) => {
clearInterval(iid);
resolve(reg.synchronizers_[syncTargetId]);
}
if (reg.initSynchronizerStates_[syncTargetId] == 'error') {
clearInterval(iid);
reject(new Error('Could not initialise synchroniser'));
}
}, 1000);
});
} else {
reg.initSynchronizerStates_[syncTargetId] = 'started';
const sync = await reg.initSynchronizer_(syncTargetId);
reg.synchronizers_[syncTargetId] = sync;
reg.initSynchronizerStates_[syncTargetId] = 'ready';
return sync;
try {
const sync = await reg.initSynchronizer_(syncTargetId);
reg.synchronizers_[syncTargetId] = sync;
reg.initSynchronizerStates_[syncTargetId] = 'ready';
return sync;
} catch (error) {
reg.initSynchronizerStates_[syncTargetId] = 'error';
throw error;
}
}
}