Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: send sync progress event after merge

Abdullah Atta9b89b328f644
diff --git a/packages/core/src/api/sync/index.js b/packages/core/src/api/sync/index.js
index 0e799ea84..e01828f44 100644
--- a/packages/core/src/api/sync/index.js
+++ b/packages/core/src/api/sync/index.js
@@ -155,9 +155,6 @@ class Sync {
if (this.connection.state !== signalr.HubConnectionState.Connected)
return;
- count += chunk.items.length;
- sendSyncProgressEvent(this.db.eventManager, "download", count);
-
clearTimeout(remoteSyncTimeout);
remoteSyncTimeout = setTimeout(() => {
this.db.eventManager.publish(EVENTS.syncAborted);
@@ -166,6 +163,9 @@ class Sync {
const key = await this.db.user.getEncryptionKey();
const dbLastSynced = await this.db.lastSynced();
await this.processChunk(chunk, key, dbLastSynced, true);
+
+ count += chunk.items.length;
+ sendSyncProgressEvent(this.db.eventManager, "download", count);
});
this.connection.on("PushCompleted", (lastSynced) => {
@@ -252,11 +252,11 @@ class Sync {
if (this.connection.state !== signalr.HubConnectionState.Connected)
return;
+ await this.processChunk(chunk, key, dbLastSynced);
+
count += chunk.items.length;
sendSyncProgressEvent(this.db.eventManager, `download`, count);
- await this.processChunk(chunk, key, dbLastSynced);
-
return true;
});
const serverResponse = await this.connection.invoke(