Skip to content

Commit

Permalink
fix ip not reached timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
qishibo committed Jun 5, 2019
1 parent 3d17293 commit 151e3da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/redisClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ bluebird.promisifyAll(redis);
export default {
createConnection(host, port, auth, menuIndex = null) {
const options = {
connect_timeout: 2000,
// max_attempts: 3,
retry_strategy: (options) => {return this.retryStragety(options, {host: host, port: port})},
no_ready_check: true,
menu_index: menuIndex,
Expand Down Expand Up @@ -65,7 +67,7 @@ export default {
console.log('retrying...', options, connection);
const maxRetryTimes = 3;

if (options.attempt > maxRetryTimes) {
if (options.attempt >= maxRetryTimes) {
alert(`${connection.host}:${connection.port}\nToo Many Attempts To Reconnect. Please Check The Server Status!`);
return false;
}
Expand Down

0 comments on commit 151e3da

Please sign in to comment.