Skip to content

Commit 231f237

Browse files
authored
fix(文章生成): 修复因为缓存导致的删除的文章还会同步的问题
1 parent f967330 commit 231f237

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Downloader.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Downloader {
8181
* @return {Promise} queue
8282
*/
8383
async fetchArticles() {
84-
const { client, config, _cachedArticles } = this;
84+
const { client, config } = this;
8585
const articles = await client.getArticles();
8686
if (!Array.isArray(articles.data)) {
8787
throw new Error(
@@ -95,6 +95,9 @@ class Downloader {
9595
)
9696
.filter(article => (config.onlyPublic ? !!article.public : true))
9797
.map(article => lodash.pick(article, PICK_PROPERTY));
98+
99+
this._cachedArticles = this._cachedArticles.filter(cache => realArticles.findIndex((item)=>item.slug === cache.slug) != -1);
100+
98101
const queue = new Queue({ concurrency: config.concurrency });
99102

100103
let article;
@@ -105,6 +108,8 @@ class Downloader {
105108
const findIndexFn = function(item) {
106109
return item.slug === article.slug;
107110
};
111+
112+
const { _cachedArticles } = this;
108113

109114
for (let i = 0; i < realArticles.length; i++) {
110115
article = realArticles[i];

0 commit comments

Comments
 (0)