Skip to content

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

fix: avoid sync locking

thecodrrb4db7d59235c
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index df8a17eda..eeb60e6d7 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -43,15 +43,10 @@ export default class SyncManager {
*/
constructor(db) {
this.sync = new Sync(db);
- this.isSyncing = false;
}
async start(full, force) {
- if (this.isSyncing) return false;
-
try {
- this.isSyncing = true;
-
await this.sync.autoSync.start();
await this.sync.start(full, force);
return true;
@@ -62,20 +57,15 @@ export default class SyncManager {
if (actualError.length > 1) throw new Error(actualError[1]);
}
throw e;
- } finally {
- this.isSyncing = false;
}
}
async acquireLock(callback) {
try {
- this.isSyncing = true;
-
this.sync.autoSync.stop();
await callback();
- await this.sync.autoSync.start();
} finally {
- this.isSyncing = false;
+ await this.sync.autoSync.start();
}
}