|
@@ -149,24 +149,27 @@ module.exports = { |
|
@@ -149,24 +149,27 @@ module.exports = { |
149
|
redis: {
|
149
|
redis: {
|
150
|
connect: {
|
150
|
connect: {
|
151
|
host: '127.0.0.1',
|
151
|
host: '127.0.0.1',
|
|
|
152
|
+
|
152
|
// host: '192.168.102.49',
|
153
|
// host: '192.168.102.49',
|
153
|
port: '6379',
|
154
|
port: '6379',
|
|
|
155
|
+ enable_offline_queue: false,
|
154
|
retry_strategy(options) {
|
156
|
retry_strategy(options) {
|
155
|
if (options.error && options.error.code === 'ECONNREFUSED') {
|
157
|
if (options.error && options.error.code === 'ECONNREFUSED') {
|
156
|
- console.log('redis连接不成功');
|
|
|
157
|
- }
|
|
|
158
|
- if (options.total_retry_time > 1000 * 60 * 60 * 6) {
|
|
|
159
|
- console.log('redis连接超时');
|
|
|
160
|
- return;
|
|
|
161
|
- }
|
|
|
162
|
- if (options.attempt > 10) {
|
|
|
163
|
- return 1000 * 60 * 60 * 0.5;
|
158
|
+ console.log('connect redis server fail');
|
164
|
}
|
159
|
}
|
|
|
160
|
+
|
|
|
161
|
+ if (options.attempt < 10) {
|
165
|
return Math.min(options.attempt * 100, 1000);
|
162
|
return Math.min(options.attempt * 100, 1000);
|
|
|
163
|
+ } else if (options.attempt > 10 && options.attempt < 100) {
|
|
|
164
|
+ return 1000;
|
|
|
165
|
+ } else {
|
|
|
166
|
+ return 1000 * 10;
|
|
|
167
|
+ }
|
166
|
}
|
168
|
}
|
167
|
},
|
169
|
},
|
168
|
session: {
|
170
|
session: {
|
169
|
host: '127.0.0.1',
|
171
|
host: '127.0.0.1',
|
|
|
172
|
+
|
170
|
// host: '192.168.102.49',
|
173
|
// host: '192.168.102.49',
|
171
|
port: '6379',
|
174
|
port: '6379',
|
172
|
prefix: 'yohobuy_session:'
|
175
|
prefix: 'yohobuy_session:'
|
|
@@ -214,18 +217,19 @@ if (isProduction) { |
|
@@ -214,18 +217,19 @@ if (isProduction) { |
214
|
connect: {
|
217
|
connect: {
|
215
|
host: 'web.redis.yohoops.org',
|
218
|
host: 'web.redis.yohoops.org',
|
216
|
port: '6379',
|
219
|
port: '6379',
|
|
|
220
|
+ enable_offline_queue: false,
|
217
|
retry_strategy(options) {
|
221
|
retry_strategy(options) {
|
218
|
if (options.error && options.error.code === 'ECONNREFUSED') {
|
222
|
if (options.error && options.error.code === 'ECONNREFUSED') {
|
219
|
- console.log('redis连接不成功');
|
|
|
220
|
- }
|
|
|
221
|
- if (options.total_retry_time > 1000 * 60 * 60 * 6) {
|
|
|
222
|
- console.log('redis连接超时');
|
|
|
223
|
- return;
|
|
|
224
|
- }
|
|
|
225
|
- if (options.attempt > 10) {
|
|
|
226
|
- return 1000 * 60 * 60 * 0.5;
|
223
|
+ console.log('connect redis server fail');
|
227
|
}
|
224
|
}
|
|
|
225
|
+
|
|
|
226
|
+ if (options.attempt < 10) {
|
228
|
return Math.min(options.attempt * 100, 1000);
|
227
|
return Math.min(options.attempt * 100, 1000);
|
|
|
228
|
+ } else if (options.attempt > 10 && options.attempt < 100) {
|
|
|
229
|
+ return 1000;
|
|
|
230
|
+ } else {
|
|
|
231
|
+ return 1000 * 10;
|
|
|
232
|
+ }
|
229
|
}
|
233
|
}
|
230
|
},
|
234
|
},
|
231
|
session: {
|
235
|
session: {
|