From a42b6770c95fe8850e078188ce62b800ab860b6e Mon Sep 17 00:00:00 2001 From: "suguo.yao" Date: Mon, 4 Oct 2021 13:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81grpc=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=99=A8=E5=8A=A0=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grpc/grpc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grpc/grpc.go b/grpc/grpc.go index 266732e..9c7e132 100644 --- a/grpc/grpc.go +++ b/grpc/grpc.go @@ -18,6 +18,7 @@ type Config struct { Address string Port int AppName string + opts []grpc.ServerOption } var rpc *grpc.Server @@ -29,12 +30,13 @@ func Init(config *Config) *grpc.Server { Address: "0.0.0.0", Port: 0, AppName: "unknown", + opts: []grpc.ServerOption{grpc.MaxRecvMsgSize(1024 * 1024), grpc.MaxSendMsgSize(1024 * 1024)}, } } conf = config if rpc == nil { - rpc = grpc.NewServer(grpc.MaxRecvMsgSize(1024*1024), grpc.MaxSendMsgSize(1024*1024)) + rpc = grpc.NewServer(conf.opts...) } return rpc }