feat: support grpc client keepalive config (#2950)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package zrpc
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/discov"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/core/stores/redis"
|
||||
@@ -14,6 +16,19 @@ type (
|
||||
// ServerMiddlewaresConf defines whether to use server middlewares.
|
||||
ServerMiddlewaresConf = internal.ServerMiddlewaresConf
|
||||
|
||||
// A RpcClientConf is a rpc client config.
|
||||
RpcClientConf struct {
|
||||
Etcd discov.EtcdConf `json:",optional,inherit"`
|
||||
Endpoints []string `json:",optional"`
|
||||
Target string `json:",optional"`
|
||||
App string `json:",optional"`
|
||||
Token string `json:",optional"`
|
||||
NonBlock bool `json:",optional"`
|
||||
Timeout int64 `json:",default=2000"`
|
||||
KeepaliveTime time.Duration `json:",default=20s"`
|
||||
Middlewares ClientMiddlewaresConf
|
||||
}
|
||||
|
||||
// A RpcServerConf is a rpc server config.
|
||||
RpcServerConf struct {
|
||||
service.ServiceConf
|
||||
@@ -29,18 +44,6 @@ type (
|
||||
Health bool `json:",default=true"`
|
||||
Middlewares ServerMiddlewaresConf
|
||||
}
|
||||
|
||||
// A RpcClientConf is a rpc client config.
|
||||
RpcClientConf struct {
|
||||
Etcd discov.EtcdConf `json:",optional,inherit"`
|
||||
Endpoints []string `json:",optional"`
|
||||
Target string `json:",optional"`
|
||||
App string `json:",optional"`
|
||||
Token string `json:",optional"`
|
||||
NonBlock bool `json:",optional"`
|
||||
Timeout int64 `json:",default=2000"`
|
||||
Middlewares ClientMiddlewaresConf
|
||||
}
|
||||
)
|
||||
|
||||
// NewDirectClientConf returns a RpcClientConf.
|
||||
|
||||
Reference in New Issue
Block a user