Authored by 周少峰

redis get time out

... ... @@ -160,14 +160,8 @@ const getLikeAsync = (skn, limit) => {
// 根据small_sort从redis获取分类下的关键词
const getRecommendKeywords = (smallSort) => {
return Promise.race([
redis.getAsync(`golobal:yoho:seo:keywords:sortId:${smallSort}`),
new Promise((resolve)=>{
setTimeout(resolve, 500, []);
})
]).then(function(res) {
return res;
return redis.all([['get', `golobal:yoho:seo:keywords:sortId:${smallSort}`]]).then(res => {
return res[0];
});
};
... ...
... ... @@ -1181,7 +1181,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
let coupon = requestData.coupon;
let limitedInfo = requestData.limited;
let bundle = requestData.bundle;
let recommendKeywords = JSON.parse(requestData.recommendKeywords);
let recommendKeywords = requestData.recommendKeywords ? JSON.parse(requestData.recommendKeywords) : [];
// 处理相似商品
result.alike = _.map(_.get(requestData, 'alike.data.product_list', ''), val =>{
... ...
... ... @@ -3,6 +3,8 @@ const _ = require('lodash');
const redis = require('redis');
const bluebird = require('bluebird');
const config = require('../../config/common');
const logger = global.yoho.logger;
const timeout = 200; // redis 操作超时时间
let client;
try {
... ... @@ -20,9 +22,14 @@ try {
}
}
return client.multi.call(client, args).execAsync();
return client.multi.call(client, args).execAsync().timeout(timeout).catch(()=>{
logger.err('redis exe time out');
return false;
});
};
client.on('error', function() {
global.yoho.redis = '';
});
... ...
... ... @@ -1944,8 +1944,12 @@ $(function() {
});
});
// 猜你喜欢、店铺推荐初始化
$('.recommend-slider-alike, .recommend-slider').slider2({
// 猜你喜欢、店铺推荐初始化,
$('.recommend-slider-alike').slider2({
shownum: 5,
isCircle: true
});
$('.recommend-slider').slider2({
shownum: 5,
isCircle: true
});
... ...