Update debug logs while fetching past contributions
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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`);
|
||||||
|
|||||||
Reference in New Issue
Block a user