Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i set grpc message size #4192

Open
dyjfighting opened this issue Jun 16, 2024 · 1 comment
Open

How can i set grpc message size #4192

dyjfighting opened this issue Jun 16, 2024 · 1 comment

Comments

@dyjfighting
Copy link

in rpc

s := zrpc.MustNewServer(c.RpcServerConf,

	func(grpcServer *grpc.Server) {

		//grpcServer.SetOption(grpc.MaxSendMsgSize(maxMessageSize))
		userCenterClient.RegisterUserServiceServer(grpcServer, userserviceServer.NewUserServiceServer(ctx))
		userCenterClient.RegisterShopServiceServer(grpcServer, shopserviceServer.NewShopServiceServer(ctx))
		userCenterClient.RegisterSubmitTaskTempServiceServer(grpcServer, submittasktempserviceServer.NewSubmitTaskTempServiceServer(ctx))
		userCenterClient.RegisterSubmitTaskServiceServer(grpcServer, submittaskserviceServer.NewSubmitTaskServiceServer(ctx))
		userCenterClient.RegisterShopGoodsLibraryServiceServer(grpcServer, shopgoodslibraryserviceServer.NewShopGoodsLibraryServiceServer(ctx))
		userCenterClient.RegisterFilterFilesServiceServer(grpcServer, filterfilesserviceServer.NewFilterFilesServiceServer(ctx))

		if c.Mode == service.DevMode || c.Mode == service.TestMode {
			reflection.Register(grpcServer)
		}
	})
//s.AddOptions(serverOpts...)
s.AddOptions(grpc.MaxRecvMsgSize(maxMessageSize), grpc.MaxSendMsgSize(maxMessageSize))
defer s.Stop()     rpc error: code = ResourceExhausted desc = grpc: received message larger than max (10591746 vs. 4194304)
@kevwan
Copy link
Contributor

kevwan commented Jun 22, 2024

Set the option in both server and client sides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants