From 5154701060dcfbc6f4c86a00821d93b175e38a86 Mon Sep 17 00:00:00 2001 From: QuentinN42 Date: Fri, 20 Oct 2023 19:32:21 +0200 Subject: [PATCH] fix: increase max grpc stream size Signed-off-by: QuentinN42 --- pkg/grpc/utils.go | 11 ++++++++++- pkg/roundtrip/roudtrip.go | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/grpc/utils.go b/pkg/grpc/utils.go index d39daf8..6593708 100644 --- a/pkg/grpc/utils.go +++ b/pkg/grpc/utils.go @@ -11,6 +11,8 @@ import ( "google.golang.org/grpc/credentials/insecure" ) +var maxMsgSize = 1024 * 1024 * 1024 + func GetCon(url string) *grpc.ClientConn { var creds grpc.DialOption if strings.Split(url, ":")[0] == "localhost" { @@ -25,7 +27,14 @@ func GetCon(url string) *grpc.ClientConn { }) creds = grpc.WithTransportCredentials(cred) } - con, err := grpc.Dial(url, creds) + con, err := grpc.Dial( + url, + creds, + grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(maxMsgSize), + grpc.MaxCallSendMsgSize(maxMsgSize), + ), + ) if err != nil { log.Fatalf("Error connecting: %v \n", err) } diff --git a/pkg/roundtrip/roudtrip.go b/pkg/roundtrip/roudtrip.go index d369451..4ee5851 100644 --- a/pkg/roundtrip/roudtrip.go +++ b/pkg/roundtrip/roudtrip.go @@ -49,6 +49,7 @@ func HandleRequest(protoReq *proto.Request) *proto.Response { logger.Error("ERROR sending request : %v", err) return protoErr(599, protoReq.Correlation) } + logger.Debug("Received response code %d (%v)", httpRes.StatusCode, protoReq.Correlation) protoRes, err := responseToTransport(httpRes, protoReq.Correlation) if err != nil {