Skip to content

Commit

Permalink
Merge pull request #406 from isucon/fix/truncate-msg
Browse files Browse the repository at this point in the history
stdout, stderrも全部末尾200行だけ送る
  • Loading branch information
fujiwara authored Nov 24, 2023
2 parents 359cfc0 + 5a87f8c commit ac84580
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bench/cmd/bench/supervise.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ func execBench(ctx context.Context, job *Job) (*Result, error) {
if err != nil {
return &Result{
ID: job.ID,
Stdout: stdout.String(),
Stderr: stderr.String(),
Stdout: joinN(strings.Split(stdout.String(), "\n"), messageLimit),
Stderr: joinN(strings.Split(stderr.String(), "\n"), messageLimit),
Reason: err.Error(),
IsPassed: false,
Score: 0,
Expand All @@ -200,8 +200,8 @@ func execBench(ctx context.Context, job *Job) (*Result, error) {
if err != nil {
return &Result{
ID: job.ID,
Stdout: stdout.String(),
Stderr: stderr.String(),
Stdout: joinN(strings.Split(stdout.String(), "\n"), messageLimit),
Stderr: joinN(strings.Split(stderr.String(), "\n"), messageLimit),
Reason: err.Error(),
IsPassed: false,
Score: 0,
Expand All @@ -215,8 +215,8 @@ func execBench(ctx context.Context, job *Job) (*Result, error) {
if err := json.NewDecoder(bytes.NewBuffer(b)).Decode(&benchResult); err != nil {
return &Result{
ID: job.ID,
Stdout: stdout.String(),
Stderr: stderr.String(),
Stdout: joinN(strings.Split(stdout.String(), "\n"), messageLimit),
Stderr: joinN(strings.Split(stderr.String(), "\n"), messageLimit),
Reason: err.Error(),
IsPassed: false,
Score: 0,
Expand All @@ -232,8 +232,8 @@ func execBench(ctx context.Context, job *Job) (*Result, error) {
log.Println("success benchmark")
return &Result{
ID: job.ID,
Stdout: stdout.String(),
Stderr: stderr.String(),
Stdout: joinN(strings.Split(stdout.String(), "\n"), messageLimit),
Stderr: joinN(strings.Split(stderr.String(), "\n"), messageLimit),
Reason: joinN(msgs, messageLimit),
IsPassed: benchResult.Pass,
Score: benchResult.Score,
Expand All @@ -246,8 +246,8 @@ func execBench(ctx context.Context, job *Job) (*Result, error) {
log.Println("fail benchmark")
return &Result{
ID: job.ID,
Stdout: stdout.String(),
Stderr: stderr.String(),
Stdout: joinN(strings.Split(stdout.String(), "\n"), messageLimit),
Stderr: joinN(strings.Split(stderr.String(), "\n"), messageLimit),
Reason: "ベンチマーク失敗",
IsPassed: false,
Score: 0,
Expand Down

0 comments on commit ac84580

Please sign in to comment.