Authored by 郝肖肖

'redis和H5保持一致'

... ... @@ -133,18 +133,20 @@ module.exports = {
connect: {
host: '127.0.0.1',
port: '6379',
password: '',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('redis连接不成功');
console.log('connect redis server fail');
}
if (options.total_retry_time > 1000 * 60 * 60 * 6) {
console.log('redis连接超时');
return;
}
if (options.attempt > 10) {
return 1000 * 60 * 60 * 0.5;
if (options.attempt < 10) {
return Math.min(options.attempt * 100, 1000);
} else if (options.attempt > 10 && options.attempt < 100) {
return 1000;
} else {
return 1000 * 10;
}
return Math.min(options.attempt * 100, 1000);
}
}
},
... ... @@ -196,21 +198,23 @@ if (isProduction) {
zookeeperServer: 'web.zookeeper.yohoops.org:2181',
redis: {
connect: {
host: 'web.redis.yohoops.org'
},
port: '6379',
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('redis连接不成功');
}
if (options.total_retry_time > 1000 * 60 * 60 * 6) {
console.log('redis连接超时');
return;
}
if (options.attempt > 10) {
return 1000 * 60 * 60 * 0.5;
host: 'redis.web.yohoops.org',
port: '6379',
password: 'redis9646',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('connect redis server fail');
}
if (options.attempt < 10) {
return Math.min(options.attempt * 100, 1000);
} else if (options.attempt > 10 && options.attempt < 100) {
return 1000;
} else {
return 1000 * 10;
}
}
return Math.min(options.attempt * 100, 1000);
}
}
});
... ...