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 643c2e7 commit a2143e0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/egrpc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Config struct {
// EnableCPUUsage bool // 是否开启CPU利用率,默认开启
EnableServiceConfig bool // 是否开启服务配置,默认开启
EnableFailOnNonTempDialError bool
MaxCallRecvMsgSize int64 // 最大接收消息大小,默认4MB
MaxCallRecvMsgSize int // 最大接收消息大小,默认4MB

keepAlive *keepalive.ClientParameters
dialOptions []grpc.DialOption
Expand Down
1 change: 1 addition & 0 deletions client/egrpc/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (c *Container) Build(options ...Option) *Component {
WithDialOption(grpc.WithChainUnaryInterceptor(c.metricUnaryClientInterceptor())),
)
}
options = append(options, WithDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(c.config.MaxCallRecvMsgSize))))

for _, option := range options {
option(c)
Expand Down
2 changes: 1 addition & 1 deletion client/egrpc/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func WithName(name string) Option {
}

// WithMaxRecvMsgSize 设置最大接收消息大小
func WithMaxRecvMsgSize(maxRecvMsgSize int64) Option {
func WithMaxRecvMsgSize(maxRecvMsgSize int) Option {
return func(c *Container) {
c.config.MaxCallRecvMsgSize = maxRecvMsgSize
}
Expand Down

0 comments on commit a2143e0

Please sign in to comment.