diff --git a/app/routes/application.js b/app/routes/application.js index d97076f..92f0e9d 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -32,8 +32,8 @@ export default Route.extend({ schedule('afterRender', this.kredits.syncContributions, this.kredits.syncContributions.perform); } - schedule('afterRender', this.kredits.fetchAllContributions, - this.kredits.fetchAllContributions.perform); + schedule('afterRender', this.kredits.fetchMissingContributions, + this.kredits.fetchMissingContributions.perform); }); } }); diff --git a/app/services/kredits.js b/app/services/kredits.js index 5d829f6..91d09e9 100644 --- a/app/services/kredits.js +++ b/app/services/kredits.js @@ -352,7 +352,7 @@ export default Service.extend({ } }), - fetchAllContributions: task(function * () { + fetchMissingContributions: task(function * () { const count = yield this.kredits.Contribution.functions.contributionsCount(); const allIds = [...Array(count+1).keys()]; allIds.shift(); // remove first item, which is 0 @@ -373,6 +373,9 @@ export default Service.extend({ const c = this.loadContributionFromData(data); yield this.browserCache.contributions.setItem(c.id.toString(), c.serialize()); countFetched++; + if (countFetched % 20 === 0) { + console.debug(`[kredits] Fetched ${countFetched} more contributions`); + } } } console.debug(`[kredits] Cached ${countFetched} past contributions`);