diff --git a/apps/infra/production/codedang/codedang_service_client.tf b/apps/infra/production/codedang/codedang_service_client.tf index ad7e03d6d3..f8f6c0b5b2 100644 --- a/apps/infra/production/codedang/codedang_service_client.tf +++ b/apps/infra/production/codedang/codedang_service_client.tf @@ -107,7 +107,7 @@ module "client_api" { ecs_service = { name = "Codedang-Client-Api-Service" cluster_arn = module.codedang_api.ecs_cluster.arn - desired_count = 2 + desired_count = 3 load_balancer = { container_name = "Codedang-Client-Api" container_port = 4000 @@ -116,7 +116,7 @@ module "client_api" { } appautoscaling_target = { - min_capacity = 2 + min_capacity = 3 max_capacity = 8 resource_id = { cluster_name = module.codedang_api.ecs_cluster.name diff --git a/apps/infra/production/codedang/codedang_service_iris.tf b/apps/infra/production/codedang/codedang_service_iris.tf index d3fdc5cbb2..1b68129a1b 100644 --- a/apps/infra/production/codedang/codedang_service_iris.tf +++ b/apps/infra/production/codedang/codedang_service_iris.tf @@ -31,7 +31,7 @@ module "iris" { task_definition = { family = "Codedang-Iris-Api" cpu = 512 - memory = 1700 + memory = 512 container_definitions = jsonencode([ jsondecode(templatefile("container_definitions/iris.json", { @@ -75,12 +75,12 @@ module "iris" { ecs_service = { name = "Codedang-Iris-Service" cluster_arn = module.codedang_iris.ecs_cluster.arn - desired_count = 2 + desired_count = 6 } appautoscaling_target = { - min_capacity = 2 - max_capacity = 8 + min_capacity = 6 + max_capacity = 6 resource_id = { cluster_name = module.codedang_iris.ecs_cluster.name } diff --git a/apps/iris/src/common/constants/constants.go b/apps/iris/src/common/constants/constants.go index 0aae1ce8cc..dccb337ead 100644 --- a/apps/iris/src/common/constants/constants.go +++ b/apps/iris/src/common/constants/constants.go @@ -53,3 +53,5 @@ const ( EXCHANGE = "judger-exchange" RESULT_KEY = "result" ) + +const MAX_OUTPUT = 1048576 // 1MB diff --git a/apps/iris/src/handler/judge-handler.go b/apps/iris/src/handler/judge-handler.go index 83c5305676..14241b1435 100644 --- a/apps/iris/src/handler/judge-handler.go +++ b/apps/iris/src/handler/judge-handler.go @@ -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)) } } @@ -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 @@ -351,6 +347,10 @@ func (j *JudgeHandler) judgeTestcase(idx int, dir string, validReq *Request, res.SetJudgeExecResult(runResult.ExecResult) res.Output = string(runResult.Output) + if len(res.Output) > constants.MAX_OUTPUT { + res.Output = res.Output[:constants.MAX_OUTPUT] + } + if runResult.ExecResult.ResultCode != sandbox.RUN_SUCCESS { res.SetJudgeResultCode(SandboxResultCodeToJudgeResultCode(runResult.ExecResult.ResultCode)) goto Send @@ -376,5 +376,4 @@ Send: // j.logger.Log(logger.DEBUG, string(marshaledRes)) out <- JudgeResultMessage{marshaledRes, ParseError(res)} } - cnt <- 1 }