From a35d98eebe2c2b19785692876eeed9708b2cfd11 Mon Sep 17 00:00:00 2001 From: Volodymyr Khoroz Date: Tue, 15 Nov 2016 16:43:56 +0200 Subject: [PATCH] [#370] Treat ping interval from config as seconds (there is no point in smaller granularity). --- server/opts.go | 2 +- server/opts_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/opts.go b/server/opts.go index 950c4bfd..6ece7476 100644 --- a/server/opts.go +++ b/server/opts.go @@ -217,7 +217,7 @@ func ProcessConfigFile(configFile string) (*Options, error) { case "max_connections", "max_conn": opts.MaxConn = int(v.(int64)) case "ping_interval": - opts.PingInterval = time.Duration(int(v.(int64))) + opts.PingInterval = time.Duration(int(v.(int64))) * time.Second case "ping_max": opts.MaxPingsOut = int(v.(int64)) case "tls": diff --git a/server/opts_test.go b/server/opts_test.go index 082f30f0..39dcf6eb 100644 --- a/server/opts_test.go +++ b/server/opts_test.go @@ -67,7 +67,7 @@ func TestConfigFile(t *testing.T) { MaxPayload: 65536, MaxConn: 100, MaxPending: 10000000, - PingInterval: 60, + PingInterval: 60 * time.Second, MaxPingsOut: 3, } @@ -189,7 +189,7 @@ func TestMergeOverrides(t *testing.T) { MaxPayload: 65536, MaxConn: 100, MaxPending: 10000000, - PingInterval: 60, + PingInterval: 60 * time.Second, MaxPingsOut: 3, ClusterNoAdvertise: true, }