Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iris): serialize testcase judging #2255

Merged
merged 3 commits into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading