From 386a8c4684b0a74e789757a889fee87981de3d9f Mon Sep 17 00:00:00 2001 From: vinllen Date: Thu, 28 Nov 2019 14:47:50 +0800 Subject: [PATCH] modify connect timeout and add keepAlive in cluster connection --- src/redis-shake/common/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/redis-shake/common/utils.go b/src/redis-shake/common/utils.go index d102ec3..96af6ef 100644 --- a/src/redis-shake/common/utils.go +++ b/src/redis-shake/common/utils.go @@ -41,11 +41,11 @@ func OpenRedisConnWithTimeout(target []string, auth_type, passwd string, readTim cluster, err := redigoCluster.NewCluster( &redigoCluster.Options{ StartNodes: target, - ConnTimeout: 1 * time.Second, + ConnTimeout: 10 * time.Second, ReadTimeout: readTimeout, WriteTimeout: writeTimeout, KeepAlive: 16, - AliveTime: 60 * time.Second, + AliveTime: time.Duration(conf.Options.KeepAlive) * time.Second, Password: passwd, }) if err != nil {