Skip to content

Commit

Permalink
refactor: remove await before cache.set
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Sep 20, 2019
1 parent caf9f46 commit 50535a9
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/routes/curseforge/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/d2/daily.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/dilidili/fanju.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/dytt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/routes/gov/veterans/bnxx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/gov/veterans/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/gov/veterans/zcjd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/iresearch/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/routes/metred/fuli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down
2 changes: 1 addition & 1 deletion lib/routes/mi/miui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/parcel/hermesuk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/readhub/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/cqu/jwc/announcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuaa/yjsy/yjsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuist/cas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuist/jwc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuist/scs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuist/sese.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuist/xgc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/universities/nuist/yjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down

0 comments on commit 50535a9

Please sign in to comment.