Skip to content

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

core: push items serially tcp style

Abdullah Attae653ce69f82c
diff --git a/packages/core/src/api/sync/index.js b/packages/core/src/api/sync/index.js
index e01828f44..24a19f178 100644
--- a/packages/core/src/api/sync/index.js
+++ b/packages/core/src/api/sync/index.js
@@ -163,9 +163,6 @@ 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) => {
@@ -313,7 +310,7 @@ class Sync {
}
}
if (!isSyncInitialized) return;
- await this.connection.send("SyncCompleted", newLastSynced);
+ await this.connection.invoke("SyncCompleted", newLastSynced);
return true;
}
@@ -427,8 +424,9 @@ class Sync {
*/
async pushItem(item, newLastSynced) {
await this.checkConnection();
- await this.connection.send("PushItems", item, newLastSynced);
- return true; // () === 1;
+ return (
+ (await this.connection.invoke("PushItems", item, newLastSynced)) === 1
+ );
}
async checkConnection() {