From 1325626397703567828a903a82fc1ed8626dbad4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 5 Aug 2024 04:39:51 +0900 Subject: feat(backend): enqueue exec task when players submit their code --- backend/taskqueue/tasks.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'backend/taskqueue/tasks.go') diff --git a/backend/taskqueue/tasks.go b/backend/taskqueue/tasks.go index 2891a36..cd67948 100644 --- a/backend/taskqueue/tasks.go +++ b/backend/taskqueue/tasks.go @@ -10,20 +10,17 @@ const ( TaskTypeExec = "exec" ) -type Testcase struct { - Stdin string - Stdout string -} - type TaskExecPlayload struct { - Code string - Testcases []*Testcase + GameID int + UserID int + Code string } -func NewExecTask(code string, testcases []*Testcase) (*asynq.Task, error) { +func NewExecTask(gameID, userID int, code string) (*asynq.Task, error) { payload, err := json.Marshal(TaskExecPlayload{ - Code: code, - Testcases: testcases, + GameID: gameID, + UserID: userID, + Code: code, }) if err != nil { return nil, err -- cgit v1.2.3-70-g09d2