Log counts of storage requests that succeeded and failed

This commit is contained in:
Dan Stillman 2016-04-27 02:35:24 -04:00
parent 1a97f27fe3
commit 0ebf49849a

View file

@ -212,17 +212,25 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function*
var changes = new Zotero.Sync.Storage.Result;
for (let type of ['download', 'upload']) {
let results = yield promises[type];
let succeeded = 0;
let failed = 0;
if (this.stopOnError) {
for (let p of results) {
if (p.isRejected()) {
for (let p of results) {
if (p.isFulfilled()) {
succeeded++;
}
else {
if (this.stopOnError) {
let e = p.reason();
Zotero.debug(`File ${type} sync failed for ${this.library.name}`);
throw e;
}
failed++;
}
}
Zotero.debug(`File ${type} sync finished for ${this.library.name}`);
Zotero.debug(`File ${type} sync finished for ${this.library.name} `
+ `(${succeeded} succeeded, ${failed} failed)`);
changes.updateFromResults(results.filter(p => p.isFulfilled()).map(p => p.value()));