Skip to content

Commit

Permalink
Adjusted max rpc message size
Browse files Browse the repository at this point in the history
  • Loading branch information
M1chlCZ committed Aug 1, 2023
1 parent 7c0ffce commit 2d54a50
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion grpcServer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"nsfw_sherlock/utils"
)

const maxMessageSize = 100 * 1024 * 1024

func StartGrpcServer() {
// Dry run for TF
test, err := common.TestPictureNSFW("./pic.jpg")
Expand All @@ -36,7 +38,12 @@ func StartGrpcServer() {

s := Server{}
//, grpc.UnaryInterceptor(serverInterceptor)
grpcServer := grpc.NewServer(grpc.Creds(insecure.NewCredentials()))
opts := []grpc.ServerOption{
grpc.Creds(insecure.NewCredentials()),
grpc.MaxRecvMsgSize(maxMessageSize),
grpc.MaxSendMsgSize(maxMessageSize),
}
grpcServer := grpc.NewServer(opts...)
grpcModels.RegisterNSFWServer(grpcServer, &s)
if err := grpcServer.Serve(lis); err != nil {
utils.WrapErrorLog(err.Error())
Expand Down

0 comments on commit 2d54a50

Please sign in to comment.