refactor: remove await before cache.set

This commit is contained in:
DIYgod
2019-09-20 15:58:30 +08:00
parent caf9f461b3
commit 50535a937a
20 changed files with 20 additions and 20 deletions

View File

@@ -36,7 +36,7 @@ module.exports = async (ctx) => {
document.pubDate = new Date(Number($item('.standard-datetime').attr('data-epoch')) * 1000).toUTCString();
document.guid = $item('.md5').text();
await ctx.cache.set(document.link, JSON.stringify(document));
ctx.cache.set(document.link, JSON.stringify(document));
return document;
});

View File

@@ -37,7 +37,7 @@ module.exports = async (ctx) => {
guid: link,
link,
};
await ctx.cache.set(link, cache);
ctx.cache.set(link, cache);
return Promise.resolve(item);
})
);

View File

@@ -21,7 +21,7 @@ async function load(link, ctx) {
// 定义description,并指定内容
const description = detailResult;
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return {
description,
};

View File

@@ -15,7 +15,7 @@ async function load(link, ctx) {
const $ = cheerio.load(response.data);
const description = $('div#Zoom').html();
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return description;
}

View File

@@ -27,7 +27,7 @@ async function load(link, ctx) {
// 定义description,并指定内容
const description = detailResult;
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return {
description,
link: link,

View File

@@ -27,7 +27,7 @@ async function load(link, ctx) {
// 定义description,并指定内容
const description = detailResult;
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return {
description,
link: link,

View File

@@ -27,7 +27,7 @@ async function load(link, ctx) {
// 定义description,并指定内容
const description = detailResult;
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return {
description,
link: link,

View File

@@ -24,7 +24,7 @@ async function processReport(item, ctx) {
description += `<img src="http://report.iresearch.cn/rimgs/${reportId}/${i}.jpg" rel="no-referrer"><br>`;
}
await ctx.cache.set(apiUrl, description);
ctx.cache.set(apiUrl, description);
return description;
}

View File

@@ -23,7 +23,7 @@ async function load(link, ctx) {
eventHtml = `<div><a href="${couponUrl}">点我前往活动</a></div>`;
}
const description = eventHtml + $('.p-detail-html').html();
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return { description };
}

View File

@@ -47,7 +47,7 @@ module.exports = async (ctx) => {
...oldPosts,
];
await ctx.cache.set(cacheName, item.slice(0, cacheLength));
ctx.cache.set(cacheName, item.slice(0, cacheLength));
}
ctx.state.data = {

View File

@@ -39,7 +39,7 @@ module.exports = async (ctx) => {
};
}
await ctx.cache.set(tracking, JSON.stringify(single));
ctx.cache.set(tracking, JSON.stringify(single));
}
ctx.state.data = {

View File

@@ -79,7 +79,7 @@ module.exports = async (ctx) => {
link,
};
await ctx.cache.set(link, JSON.stringify(item));
ctx.cache.set(link, JSON.stringify(item));
} else {
const description = news.summaryAuto || news.summary || news.title;
item = {

View File

@@ -47,7 +47,7 @@ module.exports = async (ctx) => {
$('div .field-items')
.find('p')
.text();
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);

View File

@@ -23,7 +23,7 @@ async function load(link, ctx) {
$(images[k]).replaceWith(`<img src="${url.resolve(host, $(images[k]).attr('src'))}" />`);
}
const description = $('.wp_articlecontent').html();
await ctx.cache.set(link, description);
ctx.cache.set(link, description);
return { description };
}

View File

@@ -71,7 +71,7 @@ module.exports = async (ctx) => {
.replace('作者:', '');
item.description = article.find('.xwco').html();
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);

View File

@@ -63,7 +63,7 @@ module.exports = async (ctx) => {
item.description = article.find('.xwco').html();
item.category = map[category];
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);

View File

@@ -49,7 +49,7 @@ module.exports = async (ctx) => {
item.description = $('.wp_articlecontent').html();
item.category = map[category];
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);

View File

@@ -55,7 +55,7 @@ module.exports = async (ctx) => {
.text();
item.description = article.find('.xwco').html();
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);

View File

@@ -43,7 +43,7 @@ module.exports = async (ctx) => {
).toUTCString();
item.description = $('.wp_articlecontent ').html();
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);

View File

@@ -58,7 +58,7 @@ module.exports = async (ctx) => {
item.description = article.find('.xwco').html();
item.category = map[category];
await ctx.cache.set(item.link, JSON.stringify(item));
ctx.cache.set(item.link, JSON.stringify(item));
return Promise.resolve(item);
})
);