chore(executor/sandbox): log pbReq byte size
All checks were successful
submodules sync / sync (push) Successful in 43s
build / build (push) Successful in 1m30s
build / trigger-build-image (push) Successful in 7s

This commit is contained in:
张泊明518370910136 2024-11-14 03:00:16 -05:00
parent 5efc3007e4
commit 6931f3d102
GPG Key ID: D47306D7062CDA9D

View File

@ -7,6 +7,7 @@ import (
"github.com/criyle/go-judge/pb"
"github.com/joint-online-judge/JOJ3/internal/stage"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
@ -42,7 +43,14 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd))
}
pbReq := &pb.Request{Cmd: pbCmds}
slog.Info("sandbox execute", "pbReq size", proto.Size(pbReq))
pbReqBytes, err := protojson.Marshal(pbReq)
if err != nil {
slog.Error("failed to marshal json", "error", err)
}
slog.Info("sandbox execute",
"pbReq size", proto.Size(pbReq),
"pbReqBytes size", len(pbReqBytes),
)
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
if err != nil {
return nil, err