Fix hang on sync restart
This commit is contained in:
parent
5d67656ea8
commit
6096d1ea62
1 changed files with 9 additions and 4 deletions
|
@ -97,11 +97,16 @@ Zotero.Sync.Runner_Module = function (options = {}) {
|
||||||
* @param {Function} [options.onError] Function to pass errors to instead of
|
* @param {Function} [options.onError] Function to pass errors to instead of
|
||||||
* handling internally (used for testing)
|
* handling internally (used for testing)
|
||||||
*/
|
*/
|
||||||
this.sync = Zotero.serial(Zotero.Promise.coroutine(function* (options = {}) {
|
this.sync = Zotero.serial(function (options = {}) {
|
||||||
|
return this._sync(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
this._sync = Zotero.Promise.coroutine(function* (options) {
|
||||||
// Clear message list
|
// Clear message list
|
||||||
_errors = [];
|
_errors = [];
|
||||||
|
|
||||||
// Shouldn't be possible
|
// Shouldn't be possible because of serial()
|
||||||
if (_syncInProgress) {
|
if (_syncInProgress) {
|
||||||
let msg = Zotero.getString('sync.error.syncInProgress');
|
let msg = Zotero.getString('sync.error.syncInProgress');
|
||||||
let e = new Zotero.Error(msg, 0, { dialogButtonText: null, frontWindowOnly: true });
|
let e = new Zotero.Error(msg, 0, { dialogButtonText: null, frontWindowOnly: true });
|
||||||
|
@ -233,14 +238,14 @@ Zotero.Sync.Runner_Module = function (options = {}) {
|
||||||
if (options.restartSync) {
|
if (options.restartSync) {
|
||||||
delete options.restartSync;
|
delete options.restartSync;
|
||||||
Zotero.debug("Restarting sync");
|
Zotero.debug("Restarting sync");
|
||||||
yield this.sync(options);
|
yield this._sync(options);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.debug("Done syncing");
|
Zotero.debug("Done syncing");
|
||||||
Zotero.Notifier.trigger('finish', 'sync', librariesToSync || []);
|
Zotero.Notifier.trigger('finish', 'sync', librariesToSync || []);
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue