mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
[#370] Ability to configure ping_interval and ping_max (with tests)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user