aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/taskqueue
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-07 22:52:44 +0900
committernsfisis <nsfisis@gmail.com>2024-08-08 04:02:37 +0900
commit4295abfd48ad8ce217b251d07102deb8aee413d5 (patch)
treeb998f6f6c61a07760f5335e4aeeecf3893fd3758 /backend/taskqueue
parent5a2217f7a9d01b925c3db6491a363e6e4db9ca42 (diff)
downloadphperkaigi-2025-albatross-4295abfd48ad8ce217b251d07102deb8aee413d5.tar.gz
phperkaigi-2025-albatross-4295abfd48ad8ce217b251d07102deb8aee413d5.tar.zst
phperkaigi-2025-albatross-4295abfd48ad8ce217b251d07102deb8aee413d5.zip
refactor: rename task result's "result" to "status" for consistency
Diffstat (limited to 'backend/taskqueue')
-rw-r--r--backend/taskqueue/processor.go24
-rw-r--r--backend/taskqueue/tasks.go2
2 files changed, 13 insertions, 13 deletions
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go
index f789e2e..135a7d2 100644
--- a/backend/taskqueue/processor.go
+++ b/backend/taskqueue/processor.go
@@ -49,7 +49,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Code string `json:"code"`
}
type swiftcResponseData struct {
- Result string `json:"result"`
+ Status string `json:"status"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
@@ -69,7 +69,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
if err := json.NewDecoder(res.Body).Decode(&resData); err != nil {
return fmt.Errorf("json.Decode failed: %v", err)
}
- if resData.Result != "success" {
+ if resData.Status != "success" {
err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: nil,
@@ -82,7 +82,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
}
p.results <- TaskExecResult{
Task: &payload,
- Result: "compile_error",
+ Status: "compile_error",
}
return fmt.Errorf("swiftc failed: %v", resData.Stderr)
}
@@ -93,7 +93,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Code string `json:"code"`
}
type wasmcResponseData struct {
- Result string `json:"result"`
+ Status string `json:"status"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
@@ -113,7 +113,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
if err := json.NewDecoder(res.Body).Decode(&resData); err != nil {
return fmt.Errorf("json.Decode failed: %v", err)
}
- if resData.Result != "success" {
+ if resData.Status != "success" {
err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: nil,
@@ -126,7 +126,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
}
p.results <- TaskExecResult{
Task: &payload,
- Result: "compile_error",
+ Status: "compile_error",
}
return fmt.Errorf("wasmc failed: %v", resData.Stderr)
}
@@ -144,7 +144,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Stdin string `json:"stdin"`
}
type testrunResponseData struct {
- Result string `json:"result"`
+ Status string `json:"status"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
@@ -165,11 +165,11 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
if err := json.NewDecoder(res.Body).Decode(&resData); err != nil {
return fmt.Errorf("json.Decode failed: %v", err)
}
- if resData.Result != "success" {
+ if resData.Status != "success" {
err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: testcase.TestcaseID,
- Status: resData.Result,
+ Status: resData.Status,
Stdout: resData.Stdout,
Stderr: resData.Stderr,
})
@@ -178,7 +178,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
}
p.results <- TaskExecResult{
Task: &payload,
- Result: resData.Result,
+ Status: resData.Status,
}
return fmt.Errorf("testrun failed: %v", resData.Stderr)
}
@@ -195,7 +195,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
}
p.results <- TaskExecResult{
Task: &payload,
- Result: "wrong_answer",
+ Status: "wrong_answer",
}
return fmt.Errorf("testrun failed: %v", resData.Stdout)
}
@@ -203,7 +203,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
p.results <- TaskExecResult{
Task: &payload,
- Result: "success",
+ Status: "success",
}
return nil
}
diff --git a/backend/taskqueue/tasks.go b/backend/taskqueue/tasks.go
index db05553..5c518f4 100644
--- a/backend/taskqueue/tasks.go
+++ b/backend/taskqueue/tasks.go
@@ -30,7 +30,7 @@ func NewExecTask(gameID, userID int, code string) (*asynq.Task, error) {
type TaskExecResult struct {
Task *TaskExecPlayload
- Result string
+ Status string
Stdout string
Stderr string
}