Skip to content
Snippets Groups Projects
Commit e51df779 authored by AlexStocks's avatar AlexStocks
Browse files

Imp: check sessin timeout; change default client conf params

parent aa6c05b8
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@ import (
import (
perrors "github.com/pkg/errors"
"github.com/dubbogo/getty"
)
type (
......@@ -94,9 +95,9 @@ func GetDefaultClientConfig() ClientConfig {
return ClientConfig{
ReconnectInterval: 0,
ConnectionNum: 16,
HeartbeatPeriod: "5s",
SessionTimeout: "20s",
PoolSize: 64,
HeartbeatPeriod: "30s",
SessionTimeout: "180s",
PoolSize: 4,
PoolTTL: 600,
GrPoolSize: 200,
QueueLen: 64,
......@@ -105,7 +106,7 @@ func GetDefaultClientConfig() ClientConfig {
CompressEncoding: false,
TcpNoDelay: true,
TcpKeepAlive: true,
KeepAlivePeriod: "120s",
KeepAlivePeriod: "180s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
......@@ -119,7 +120,7 @@ func GetDefaultClientConfig() ClientConfig {
func GetDefaultServerConfig() ServerConfig {
return ServerConfig{
SessionTimeout: "20s",
SessionTimeout: "180s",
SessionNumber: 700,
GrPoolSize: 120,
QueueNumber: 6,
......@@ -128,7 +129,7 @@ func GetDefaultServerConfig() ServerConfig {
CompressEncoding: false,
TcpNoDelay: true,
TcpKeepAlive: true,
KeepAlivePeriod: "120s",
KeepAlivePeriod: "180s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
......@@ -172,6 +173,11 @@ func (c *ClientConfig) CheckValidity() error {
return perrors.WithMessagef(err, "time.ParseDuration(HeartbeatPeroid{%#v})", c.HeartbeatPeriod)
}
if c.heartbeatPeriod >= time.Duration(getty.MaxWheelTimeSpan) {
return perrors.WithMessagef(err, "heartbeat_period %s should be less than %s",
c.HeartbeatPeriod, time.Duration(getty.MaxWheelTimeSpan))
}
if c.sessionTimeout, err = time.ParseDuration(c.SessionTimeout); err != nil {
return perrors.WithMessagef(err, "time.ParseDuration(SessionTimeout{%#v})", c.SessionTimeout)
}
......@@ -186,5 +192,10 @@ func (c *ServerConfig) CheckValidity() error {
return perrors.WithMessagef(err, "time.ParseDuration(SessionTimeout{%#v})", c.SessionTimeout)
}
if c.sessionTimeout >= time.Duration(getty.MaxWheelTimeSpan) {
return perrors.WithMessagef(err, "session_timeout %s should be less than %s",
c.SessionTimeout, time.Duration(getty.MaxWheelTimeSpan))
}
return perrors.WithStack(c.GettySessionParam.CheckValidity())
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment