From 5bce7f13e544d8fd299cbed843f4b4a4ccddfed5 Mon Sep 17 00:00:00 2001 From: fengzi Date: Thu, 14 Jun 2018 10:13:40 +0800 Subject: [PATCH] rpc:gateway.go set rcp MaxGateWayRecvMsgSize --- rpc/gateway.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpc/gateway.go b/rpc/gateway.go index d2900a89c..b5a043604 100644 --- a/rpc/gateway.go +++ b/rpc/gateway.go @@ -25,6 +25,8 @@ const ( const ( // DefaultHTTPLimit default max http conns DefaultHTTPLimit = 128 + // MaxRecvMsgSize Deafult max message size gateway's grpc client can receive + MaxGateWayRecvMsgSize = 64 * 1024 * 1024 ) // Run start gateway proxy to mapping grpc to http. @@ -37,7 +39,9 @@ func Run(config *nebletpb.RPCConfig) error { mux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: true, EmitDefaults: true}), runtime.WithProtoErrorHandler(errorHandler)) - opts := []grpc.DialOption{grpc.WithInsecure()} + opts := []grpc.DialOption{grpc.WithInsecure(), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(MaxGateWayRecvMsgSize))} + echoEndpoint := flag.String("rpc", config.RpcListen[0], "") for _, v := range config.HttpModule { switch v {