Authored by 郭成尧

redis-timeout-200

... ... @@ -20,6 +20,7 @@ const searchProcess = require(`${utils}/search-process`);
const stringProcess = require(`${utils}/string-process`);
const listParamsProcess = require(`${utils}/list-params-process`);
const redis = require(`${utils}/redis`);
const logger = global.yoho.logger;
/**
* 封面图
... ... @@ -325,6 +326,7 @@ const listNew = (req, res, next) => {
}
co(function* () {
let result = yield req.ctx(searchModel).getCategoryGoods(initialData);
let categoryIntroRedis = [];
let responseResult = {
list: productProcess.processProductList(result.data.product_list || [], {
... ... @@ -344,8 +346,13 @@ const listNew = (req, res, next) => {
seoTitle = decodeURIComponent(params.sort_name);
}
let categoryIntroRedis =
yield redis.hmgetAsync(`category:description:${md5(seoTitle)}`, 'category', 'description');
try {
categoryIntroRedis =
yield redis.hmgetAsync(`category:description:${md5(seoTitle)}`, 'category', 'description').timeout(200);
} catch (e) {
logger.error('redis.hmgetAsync.category.description:' + e);
}
let categoryIntro = categoryIntroRedis[1] ? {
title: categoryIntroRedis[0],
desc: categoryIntroRedis[1]
... ...