feat(executor): default 2 GiB grpc msg size
This commit is contained in:
		
							parent
							
								
									adb9dd2a9a
								
							
						
					
					
						commit
						153c261ab8
					
				|  | @ -3,6 +3,7 @@ package sandbox | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"log/slog" | 	"log/slog" | ||||||
|  | 	"math" | ||||||
| 
 | 
 | ||||||
| 	"github.com/criyle/go-judge/pb" | 	"github.com/criyle/go-judge/pb" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
|  | @ -21,10 +22,11 @@ func createExecClient(execServer, token string) (pb.ExecutorClient, error) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func createGRPCConnection(addr, token string) (*grpc.ClientConn, error) { | func createGRPCConnection(addr, token string) (*grpc.ClientConn, error) { | ||||||
|  | 	// max size according to https://protobuf.dev/programming-guides/encoding/#size-limit
 | ||||||
| 	opts := []grpc.DialOption{ | 	opts := []grpc.DialOption{ | ||||||
| 		grpc.WithTransportCredentials(insecure.NewCredentials()), | 		grpc.WithTransportCredentials(insecure.NewCredentials()), | ||||||
| 		grpc.WithDefaultCallOptions( | 		grpc.WithDefaultCallOptions( | ||||||
| 			grpc.MaxCallRecvMsgSize(512 * 1024 * 1024), // 512 MB
 | 			grpc.MaxCallRecvMsgSize(math.MaxInt32), // 2 GB
 | ||||||
| 		), | 		), | ||||||
| 	} | 	} | ||||||
| 	if token != "" { | 	if token != "" { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user