From 2ba773d612d8a9a3de315d8d21df61f6253acac2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 7 Jul 2017 19:05:22 -0400 Subject: [PATCH] Additional checks for stopped sync --- chrome/content/zotero/xpcom/sync/syncEngine.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chrome/content/zotero/xpcom/sync/syncEngine.js b/chrome/content/zotero/xpcom/sync/syncEngine.js index 036ab67a4..a026f3224 100644 --- a/chrome/content/zotero/xpcom/sync/syncEngine.js +++ b/chrome/content/zotero/xpcom/sync/syncEngine.js @@ -131,6 +131,9 @@ Zotero.Sync.Data.Engine.prototype.start = Zotero.Promise.coroutine(function* () uploadResult = yield this._startUpload(); } catch (e) { + if (e instanceof Zotero.Sync.UserCancelledException) { + throw e; + } Zotero.debug("Upload failed -- performing download", 2); downloadResult = yield this._startDownload(); Zotero.debug("Download result is " + downloadResult, 4); @@ -224,6 +227,8 @@ Zotero.Sync.Data.Engine.prototype._startDownload = Zotero.Promise.coroutine(func loop: while (true) { + this._statusCheck(); + // Get synced settings first, since they affect how other data is displayed let results = yield this._downloadSettings(libraryVersion); if (results.result == this.DOWNLOAD_RESULT_LIBRARY_UNMODIFIED) { @@ -1119,6 +1124,8 @@ Zotero.Sync.Data.Engine.prototype._uploadObjects = Zotero.Promise.coroutine(func try { while (queue.length) { + this._statusCheck(); + // Get a slice of the queue and generate JSON for objects if necessary let batch = []; let numSkipped = 0; @@ -1556,6 +1563,8 @@ Zotero.Sync.Data.Engine.prototype._fullSync = Zotero.Promise.coroutine(function* loop: while (true) { + this._statusCheck(); + // Reprocess all deletions available from API let result = yield this._downloadDeletions(0, lastLibraryVersion); if (result == this.DOWNLOAD_RESULT_RESTART) {