From 4bf8b5a128b70cad518e5deeeeeec86315428837 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 24 Jul 2018 09:57:02 +0300 Subject: [PATCH] Enable keep-alive by default --- CHANGELOG.md | 1 + options.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c166c61..cb0e1b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Ring got new options called `HashReplicas` and `Hash`. It is recommended to set `HashReplicas = 1000` for better keys distribution between shards. - Cluster client was optimized to use much less memory when reloading cluster state. - PubSub.ReceiveMessage is re-worked to not use ReceiveTimeout so it does not lose data when timeout occurres. In most cases it is recommended to use PubSub.Channel instead. +- Dialer.KeepAlive is set to 5 minutes by default. ## v6.12 diff --git a/options.go b/options.go index ebd0adb..8a82d59 100644 --- a/options.go +++ b/options.go @@ -85,7 +85,10 @@ func (opt *Options) init() { } if opt.Dialer == nil { opt.Dialer = func() (net.Conn, error) { - netDialer := &net.Dialer{Timeout: opt.DialTimeout} + netDialer := &net.Dialer{ + Timeout: opt.DialTimeout, + KeepAlive: 5 * time.Minute, + } if opt.TLSConfig == nil { return netDialer.Dial(opt.Network, opt.Addr) } else {