feat(executor): default 2 GiB grpc msg size
All checks were successful
submodules sync / sync (push) Successful in 39s
build / build (push) Successful in 1m19s
build / trigger-build-image (push) Successful in 7s

This commit is contained in:
张泊明518370910136 2024-11-06 07:46:44 -05:00
parent adb9dd2a9a
commit 153c261ab8
GPG Key ID: D47306D7062CDA9D

View File

@ -3,6 +3,7 @@ package sandbox
import (
"context"
"log/slog"
"math"
"github.com/criyle/go-judge/pb"
"google.golang.org/grpc"
@ -21,10 +22,11 @@ func createExecClient(execServer, token string) (pb.ExecutorClient, error) {
}
func createGRPCConnection(addr, token string) (*grpc.ClientConn, error) {
// max size according to https://protobuf.dev/programming-guides/encoding/#size-limit
opts := []grpc.DialOption{
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(512 * 1024 * 1024), // 512 MB
grpc.MaxCallRecvMsgSize(math.MaxInt32), // 2 GB
),
}
if token != "" {