diff --git a/client/egrpc/config.go b/client/egrpc/config.go index a9fb22d9..a2d0bb7e 100644 --- a/client/egrpc/config.go +++ b/client/egrpc/config.go @@ -28,9 +28,10 @@ type Config struct { EnableAccessInterceptor bool // 是否开启记录请求数据,默认不开启 EnableAccessInterceptorReq bool // 是否开启记录请求参数,默认不开启 EnableAccessInterceptorRes bool // 是否开启记录响应参数,默认不开启 - //EnableCPUUsage bool // 是否开启CPU利用率,默认开启 + // EnableCPUUsage bool // 是否开启CPU利用率,默认开启 EnableServiceConfig bool // 是否开启服务配置,默认开启 EnableFailOnNonTempDialError bool + MaxCallRecvMsgSize int64 // 最大接收消息大小,默认4MB keepAlive *keepalive.ClientParameters dialOptions []grpc.DialOption @@ -56,6 +57,7 @@ func DefaultConfig() *Config { EnableAccessInterceptorReq: false, EnableAccessInterceptorRes: false, EnableServiceConfig: true, - //EnableCPUUsage: true, + // EnableCPUUsage: true, + MaxCallRecvMsgSize: 1024 * 1024 * 4, } } diff --git a/client/egrpc/option.go b/client/egrpc/option.go index 9e13b557..1345d148 100644 --- a/client/egrpc/option.go +++ b/client/egrpc/option.go @@ -95,3 +95,10 @@ func WithName(name string) Option { c.name = name } } + +// WithMaxRecvMsgSize 设置最大接收消息大小 +func WithMaxRecvMsgSize(maxRecvMsgSize int64) Option { + return func(c *Container) { + c.config.MaxCallRecvMsgSize = maxRecvMsgSize + } +}