diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-05 04:39:51 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-05 05:14:30 +0900 |
| commit | 1325626397703567828a903a82fc1ed8626dbad4 (patch) | |
| tree | d667f50894676a7bb208c03a7e96812ef0d029b9 /backend/taskqueue | |
| parent | 940fc430a5c8fa7a1454cc84586eaca2722ac757 (diff) | |
| download | phperkaigi-2025-albatross-1325626397703567828a903a82fc1ed8626dbad4.tar.gz phperkaigi-2025-albatross-1325626397703567828a903a82fc1ed8626dbad4.tar.zst phperkaigi-2025-albatross-1325626397703567828a903a82fc1ed8626dbad4.zip | |
feat(backend): enqueue exec task when players submit their code
Diffstat (limited to 'backend/taskqueue')
| -rw-r--r-- | backend/taskqueue/tasks.go | 17 |
1 files changed, 7 insertions, 10 deletions
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 |
