Update debug logs while fetching past contributions

This commit is contained in:
2020-05-29 22:28:42 +02:00
parent bac4c1c425
commit 302c3315a3
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -32,8 +32,8 @@ export default Route.extend({
schedule('afterRender', this.kredits.syncContributions, schedule('afterRender', this.kredits.syncContributions,
this.kredits.syncContributions.perform); this.kredits.syncContributions.perform);
} }
schedule('afterRender', this.kredits.fetchAllContributions, schedule('afterRender', this.kredits.fetchMissingContributions,
this.kredits.fetchAllContributions.perform); this.kredits.fetchMissingContributions.perform);
}); });
} }
}); });
+4 -1
View File
@@ -352,7 +352,7 @@ export default Service.extend({
} }
}), }),
fetchAllContributions: task(function * () { fetchMissingContributions: task(function * () {
const count = yield this.kredits.Contribution.functions.contributionsCount(); const count = yield this.kredits.Contribution.functions.contributionsCount();
const allIds = [...Array(count+1).keys()]; const allIds = [...Array(count+1).keys()];
allIds.shift(); // remove first item, which is 0 allIds.shift(); // remove first item, which is 0
@@ -373,6 +373,9 @@ export default Service.extend({
const c = this.loadContributionFromData(data); const c = this.loadContributionFromData(data);
yield this.browserCache.contributions.setItem(c.id.toString(), c.serialize()); yield this.browserCache.contributions.setItem(c.id.toString(), c.serialize());
countFetched++; countFetched++;
if (countFetched % 20 === 0) {
console.debug(`[kredits] Fetched ${countFetched} more contributions`);
}
} }
} }
console.debug(`[kredits] Cached ${countFetched} past contributions`); console.debug(`[kredits] Cached ${countFetched} past contributions`);