Fix mistake whereby the caches for each guild would update synchronously

This commit is contained in:
benji7425 2017-07-29 20:40:55 +01:00
parent c82bece834
commit 5e5929565e
1 changed files with 6 additions and 8 deletions

View File

@ -8,14 +8,12 @@ module.exports = class GuildData {
}
cachePastPostedLinks() {
let i = 0;
const recurse = () => {
this.feeds[i++].cachePastPostedLinks(this)
.catch(Util.dateError)
.then(recurse);
if (i > this.feeds.length)
return Promise.resolve();
};
const promises = [];
this.feeds.forEach(feed => {
promises.push(feed.cachePastPostedLinks(this).catch(Util.dateError));
});
return Promise.all(promises);
}
};