Update Zotero.Sync.Storage.QueueManager.start() for async item.clone()
Via _reconcileConflicts()
This commit is contained in:
parent
bb3496dfa8
commit
304f46c8cc
|
@ -28,7 +28,7 @@ Zotero.Sync.Storage.QueueManager = new function () {
|
||||||
var _queues = {};
|
var _queues = {};
|
||||||
var _currentQueues = [];
|
var _currentQueues = [];
|
||||||
|
|
||||||
this.start = function (libraryID) {
|
this.start = Zotero.Promise.coroutine(function* (libraryID) {
|
||||||
if (libraryID) {
|
if (libraryID) {
|
||||||
var queues = this.getAll(libraryID);
|
var queues = this.getAll(libraryID);
|
||||||
var suffix = " for library " + libraryID;
|
var suffix = " for library " + libraryID;
|
||||||
|
@ -53,27 +53,27 @@ Zotero.Sync.Storage.QueueManager = new function () {
|
||||||
Zotero.debug("No files to sync" + suffix);
|
Zotero.debug("No files to sync" + suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Zotero.Promise.allSettled(promises)
|
var results = yield Zotero.Promise.allSettled(promises);
|
||||||
.then(function (results) {
|
|
||||||
Zotero.debug("All storage queues are finished" + suffix);
|
Zotero.debug("All storage queues are finished" + suffix);
|
||||||
|
|
||||||
results.forEach(function (result) {
|
for (let i = 0; i < results.length; i++) {
|
||||||
|
let result = results[i];
|
||||||
// Check for conflicts to resolve
|
// Check for conflicts to resolve
|
||||||
if (result.state == "fulfilled") {
|
if (result.state == "fulfilled") {
|
||||||
result = result.value;
|
result = result.value;
|
||||||
if (result.conflicts.length) {
|
if (result.conflicts.length) {
|
||||||
Zotero.debug("Reconciling conflicts for library " + result.libraryID);
|
Zotero.debug("Reconciling conflicts for library " + result.libraryID);
|
||||||
Zotero.debug(result.conflicts);
|
Zotero.debug(result.conflicts);
|
||||||
var data = _reconcileConflicts(result.conflicts);
|
var data = yield _reconcileConflicts(result.conflicts);
|
||||||
if (data) {
|
if (data) {
|
||||||
_processMergeData(data);
|
_processMergeData(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
return promises;
|
return promises;
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
this.stop = function (libraryID) {
|
this.stop = function (libraryID) {
|
||||||
if (libraryID) {
|
if (libraryID) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user