commit 2ba773d612d8a9a3de315d8d21df61f6253acac2
parent 043c0ac6b7ee1a8d461a12d84c52c29ceb61a225
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 7 Jul 2017 19:05:22 -0400
Additional checks for stopped sync
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git 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) {