Skip to content

Commit

Permalink
add MaxCallRecvMsgSize
Browse files Browse the repository at this point in the history
  • Loading branch information
clannadxr committed Jan 8, 2024
1 parent bbbcf25 commit 643c2e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/egrpc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,6 +57,7 @@ func DefaultConfig() *Config {
EnableAccessInterceptorReq: false,
EnableAccessInterceptorRes: false,
EnableServiceConfig: true,
//EnableCPUUsage: true,
// EnableCPUUsage: true,
MaxCallRecvMsgSize: 1024 * 1024 * 4,
}
}
7 changes: 7 additions & 0 deletions client/egrpc/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 643c2e7

Please sign in to comment.