Skip to content

Commit

Permalink
grpc: add grpc msg size config and set default to 64m
Browse files Browse the repository at this point in the history
fix #96
  • Loading branch information
criyle committed Mar 4, 2024
1 parent b0c85a6 commit da37931
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmd/go-judge/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ type Config struct {
FileTimeout time.Duration `flagUsage:"specified timeout for filestore files"`

// server config
HTTPAddr string `flagUsage:"specifies the http binding address"`
EnableGRPC bool `flagUsage:"enable gRPC endpoint"`
GRPCAddr string `flagUsage:"specifies the grpc binding address"`
MonitorAddr string `flagUsage:"specifies the metrics binding address"`
AuthToken string `flagUsage:"bearer token auth for REST / gRPC"`
EnableDebug bool `flagUsage:"enable debug endpoint"`
EnableMetrics bool `flagUsage:"enable prometheus metrics endpoint"`
HTTPAddr string `flagUsage:"specifies the http binding address"`
EnableGRPC bool `flagUsage:"enable gRPC endpoint"`
GRPCAddr string `flagUsage:"specifies the grpc binding address"`
MonitorAddr string `flagUsage:"specifies the metrics binding address"`
AuthToken string `flagUsage:"bearer token auth for REST / gRPC"`
GRPCMsgSize *envexec.Size `flagUsage:"message size limit for gRPC message" default:"64m"`
EnableDebug bool `flagUsage:"enable debug endpoint"`
EnableMetrics bool `flagUsage:"enable prometheus metrics endpoint"`

// logger config
Release bool `flagUsage:"release level of logs"`
Expand Down
1 change: 1 addition & 0 deletions cmd/go-judge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ func newGRPCServer(conf *config.Config, esServer pb.ExecutorServer) *grpc.Server
grpcServer := grpc.NewServer(
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(streamMiddleware...)),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryMiddleware...)),
grpc.MaxRecvMsgSize(int(conf.GRPCMsgSize.Byte())),
)
pb.RegisterExecutorServer(grpcServer, esServer)
grpc_prometheus.Register(grpcServer)
Expand Down

0 comments on commit da37931

Please sign in to comment.