diff --git a/server/configs/test.conf b/server/configs/test.conf index 74e0c537..689a815c 100644 --- a/server/configs/test.conf +++ b/server/configs/test.conf @@ -36,3 +36,7 @@ max_payload: 65536 # slow consumer threshold max_pending_size: 10000000 + +# ping interval and no pong threshold +ping_interval: 60 +ping_max: 3 diff --git a/server/opts.go b/server/opts.go index 3bfca3ea..950c4bfd 100644 --- a/server/opts.go +++ b/server/opts.go @@ -216,6 +216,10 @@ func ProcessConfigFile(configFile string) (*Options, error) { opts.MaxPending = int(v.(int64)) case "max_connections", "max_conn": opts.MaxConn = int(v.(int64)) + case "ping_interval": + opts.PingInterval = time.Duration(int(v.(int64))) + case "ping_max": + opts.MaxPingsOut = int(v.(int64)) case "tls": tlsm := v.(map[string]interface{}) tc, err := parseTLS(tlsm) diff --git a/server/opts_test.go b/server/opts_test.go index e41b043c..082f30f0 100644 --- a/server/opts_test.go +++ b/server/opts_test.go @@ -67,6 +67,8 @@ func TestConfigFile(t *testing.T) { MaxPayload: 65536, MaxConn: 100, MaxPending: 10000000, + PingInterval: 60, + MaxPingsOut: 3, } opts, err := ProcessConfigFile("./configs/test.conf") @@ -187,6 +189,8 @@ func TestMergeOverrides(t *testing.T) { MaxPayload: 65536, MaxConn: 100, MaxPending: 10000000, + PingInterval: 60, + MaxPingsOut: 3, ClusterNoAdvertise: true, } fopts, err := ProcessConfigFile("./configs/test.conf")