Skip to content

Commit

Permalink
feat(iris): serialize testcase judging (#2255)
Browse files Browse the repository at this point in the history
feat(be): serialize testcase judging
- 병렬적으로 처리되고 있던 tc 채점을 직렬화합니다.
  • Loading branch information
Jaehyeon1020 authored Dec 7, 2024
1 parent 449b44e commit 09c4ca3
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions apps/iris/src/handler/judge-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,9 @@ func (j *JudgeHandler) Handle(id string, data []byte, hidden bool, out chan Judg
}

tcNum := tc.Count()
cnt := make(chan int)
for i := 0; i < tcNum; i++ {
go j.judgeTestcase(i, dir, validReq, tc.Elements[i], out, cnt)
}

for i := 0; i < tcNum; i++ {
<-cnt
j.judgeTestcase(i, dir, validReq, tc.Elements[i], out)
// j.logger.Log(logger.DEBUG, fmt.Sprintf("Testcase %d judged", i))
}
}

Expand Down Expand Up @@ -324,7 +320,7 @@ func (j *JudgeHandler) getTestcase(traceCtx context.Context, out chan<- result.C
}

func (j *JudgeHandler) judgeTestcase(idx int, dir string, validReq *Request,
tc loader.Element, out chan JudgeResultMessage, cnt chan int) {
tc loader.Element, out chan JudgeResultMessage) {

var accepted bool

Expand Down Expand Up @@ -376,5 +372,4 @@ Send:
// j.logger.Log(logger.DEBUG, string(marshaledRes))
out <- JudgeResultMessage{marshaledRes, ParseError(res)}
}
cnt <- 1
}

0 comments on commit 09c4ca3

Please sign in to comment.