mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
lower lastSyncedPull if server max sync ID is lower
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const url = require('url');
|
||||
const log = require('./log');
|
||||
const sql = require('./sql');
|
||||
const sqlInit = require('./sql_init');
|
||||
@@ -99,6 +98,16 @@ async function doLogin() {
|
||||
|
||||
syncContext.sourceId = resp.sourceId;
|
||||
|
||||
const lastSyncedPull = await getLastSyncedPull();
|
||||
|
||||
// this is important in a scenario where we setup the sync by manually copying the document
|
||||
// lastSyncedPull then could be pretty off for the newly cloned client
|
||||
if (lastSyncedPull > resp.maxSyncId) {
|
||||
log.info(`Lowering last synced pull from ${lastSyncedPull} to ${resp.maxSyncId}`);
|
||||
|
||||
await setLastSyncedPull(resp.maxSyncId);
|
||||
}
|
||||
|
||||
return syncContext;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user