Skip to content

Commit

Permalink
feat(iris): set limit 1MB
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehyeon1020 committed Dec 7, 2024
1 parent 8d836e0 commit c917947
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions apps/iris/src/common/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ const (
EXCHANGE = "judger-exchange"
RESULT_KEY = "result"
)

const MAX_OUTPUT = 1048576 // 1MB
5 changes: 2 additions & 3 deletions apps/iris/src/handler/judge-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,8 @@ func (j *JudgeHandler) judgeTestcase(idx int, dir string, validReq *Request,
res.SetJudgeExecResult(runResult.ExecResult)
res.Output = string(runResult.Output)

// Output이 1000자를 넘어가는 경우 1000자까지만 사용
if len(res.Output) > 1000 {
res.Output = res.Output[:1000]
if len(res.Output) > constants.MAX_OUTPUT {
res.Output = res.Output[:constants.MAX_OUTPUT]
}

if runResult.ExecResult.ResultCode != sandbox.RUN_SUCCESS {
Expand Down

0 comments on commit c917947

Please sign in to comment.