From 8f5aeb70652fb9b537dea1c78d1bc34d6937550b Mon Sep 17 00:00:00 2001 From: evalphobia Date: Mon, 26 Sep 2016 15:22:39 +0900 Subject: [PATCH] Disable idle checks for cluster connection --- cluster.go | 3 +++ options.go | 1 + 2 files changed, 4 insertions(+) diff --git a/cluster.go b/cluster.go index 07de993..6aacd03 100644 --- a/cluster.go +++ b/cluster.go @@ -627,6 +627,8 @@ func (opt *ClusterOptions) init() { } func (opt *ClusterOptions) clientOptions() *Options { + const disableIdleCheck = -1 + return &Options{ Password: opt.Password, ReadOnly: opt.ReadOnly, @@ -640,5 +642,6 @@ func (opt *ClusterOptions) clientOptions() *Options { IdleTimeout: opt.IdleTimeout, // IdleCheckFrequency is not copied to disable reaper + IdleCheckFrequency: disableIdleCheck, } } diff --git a/options.go b/options.go index 3f9a462..bfe2e8a 100644 --- a/options.go +++ b/options.go @@ -53,6 +53,7 @@ type Options struct { IdleTimeout time.Duration // Frequency of idle checks. // Default is 1 minute. + // When minus value is set, then idle check is disabled. IdleCheckFrequency time.Duration // Enables read only queries on slave nodes.