1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Sync fixes

This commit is contained in:
Laurent Cozic
2017-07-19 20:15:55 +01:00
parent df3e5ac40c
commit 5ca8647d35
18 changed files with 264 additions and 99 deletions

View File

@ -74,7 +74,9 @@ reg.synchronizer = async () => {
return reg.synchronizer_;
}
reg.scheduleSync = async () => {
reg.scheduleSync = async (delay = null) => {
if (delay === null) delay = 1000 * 10;
if (reg.scheduleSyncId_) {
clearTimeout(reg.scheduleSyncId_);
reg.scheduleSyncId_ = null;
@ -92,8 +94,12 @@ reg.scheduleSync = async () => {
}
const sync = await reg.synchronizer();
sync.start();
}, 1000 * 10);
let context = Setting.value('sync.context');
context = context ? JSON.parse(context) : {};
let newContext = await sync.start({ context: context });
Setting.setValue('sync.context', JSON.stringify(newContext));
}, delay);
}
reg.setDb = (v) => {