mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
core: always send sync request to client
This commit is contained in:
@@ -284,8 +284,8 @@ class Database {
|
|||||||
return (await this.storage.read("lastSynced")) || 0;
|
return (await this.storage.read("lastSynced")) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync(full = true, force = false) {
|
sync(full = true, force = false, lastSynced = null) {
|
||||||
return this.syncer.start(full, force);
|
return this.syncer.start(full, force, lastSynced);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -323,6 +323,11 @@ class Sync {
|
|||||||
if (lastSynced > storedLastSynced)
|
if (lastSynced > storedLastSynced)
|
||||||
await this.db.storage.write("lastSynced", lastSynced);
|
await this.db.storage.write("lastSynced", lastSynced);
|
||||||
this.db.eventManager.publish(EVENTS.syncCompleted);
|
this.db.eventManager.publish(EVENTS.syncCompleted);
|
||||||
|
|
||||||
|
// refresh monographs on sync completed
|
||||||
|
await this.db.monographs.init();
|
||||||
|
// refresh topic references
|
||||||
|
this.db.notes.topicReferences.rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancel() {
|
async cancel() {
|
||||||
@@ -359,13 +364,13 @@ class Sync {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
async onPushCompleted(lastSynced) {
|
onPushCompleted(lastSynced) {
|
||||||
// refresh monographs on sync completed
|
this.db.eventManager.publish(
|
||||||
await this.db.monographs.init();
|
EVENTS.databaseSyncRequested,
|
||||||
// refresh topic references
|
false,
|
||||||
this.db.notes.topicReferences.rebuild();
|
false,
|
||||||
|
lastSynced
|
||||||
await this.start(false, false, lastSynced);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async processChunk(chunk, key, dbLastSynced, notify = false) {
|
async processChunk(chunk, key, dbLastSynced, notify = false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user