mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
core: turn off sync push by default
This commit is contained in:
@@ -293,39 +293,41 @@ class Sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async send(oldLastSynced, isForceSync, newLastSynced) {
|
async send(oldLastSynced, isForceSync, newLastSynced) {
|
||||||
await this.uploadAttachments();
|
return false;
|
||||||
|
|
||||||
let isSyncInitialized = false;
|
// await this.uploadAttachments();
|
||||||
let done = 0;
|
|
||||||
for await (const item of this.collector.collect(
|
|
||||||
100,
|
|
||||||
oldLastSynced,
|
|
||||||
isForceSync
|
|
||||||
)) {
|
|
||||||
if (!isSyncInitialized) {
|
|
||||||
const vaultKey = await this.db.vault._getKey();
|
|
||||||
newLastSynced = await this.connection.invoke("InitializePush", {
|
|
||||||
vaultKey,
|
|
||||||
lastSynced: newLastSynced
|
|
||||||
});
|
|
||||||
isSyncInitialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.pushItem(item, newLastSynced);
|
// let isSyncInitialized = false;
|
||||||
if (result) {
|
// let done = 0;
|
||||||
done += item.items.length;
|
// for await (const item of this.collector.collect(
|
||||||
sendSyncProgressEvent(this.db.eventManager, "upload", done);
|
// 100,
|
||||||
|
// oldLastSynced,
|
||||||
|
// isForceSync
|
||||||
|
// )) {
|
||||||
|
// if (!isSyncInitialized) {
|
||||||
|
// const vaultKey = await this.db.vault._getKey();
|
||||||
|
// newLastSynced = await this.connection.invoke("InitializePush", {
|
||||||
|
// vaultKey,
|
||||||
|
// lastSynced: newLastSynced
|
||||||
|
// });
|
||||||
|
// isSyncInitialized = true;
|
||||||
|
// }
|
||||||
|
|
||||||
this.logger.info(`Batch sent (${done})`);
|
// const result = await this.pushItem(item, newLastSynced);
|
||||||
} else {
|
// if (result) {
|
||||||
this.logger.error(
|
// done += item.items.length;
|
||||||
new Error(`Failed to send batch. Server returned falsy response.`)
|
// sendSyncProgressEvent(this.db.eventManager, "upload", done);
|
||||||
);
|
|
||||||
}
|
// this.logger.info(`Batch sent (${done})`);
|
||||||
}
|
// } else {
|
||||||
if (!isSyncInitialized) return;
|
// this.logger.error(
|
||||||
await this.connection.invoke("SyncCompleted", newLastSynced);
|
// new Error(`Failed to send batch. Server returned falsy response.`)
|
||||||
return true;
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (!isSyncInitialized) return;
|
||||||
|
// await this.connection.invoke("SyncCompleted", newLastSynced);
|
||||||
|
// return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async stop(lastSynced) {
|
async stop(lastSynced) {
|
||||||
|
|||||||
Reference in New Issue
Block a user