aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/taskqueue/processor.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-08 21:17:13 +0900
committernsfisis <nsfisis@gmail.com>2024-08-08 21:17:13 +0900
commita100dc8ba76aaeda2229940c1743c33cc0ef84b5 (patch)
treee2e48d8d92e2601d65e3ce7d794d8727026c14e0 /backend/taskqueue/processor.go
parentbb62b6ff19d9f8008458d1c0ad0b8b76090f091e (diff)
parent3b13a61123becc63823ab0c0941aaff2048b020e (diff)
downloadiosdc-japan-2024-albatross-a100dc8ba76aaeda2229940c1743c33cc0ef84b5.tar.gz
iosdc-japan-2024-albatross-a100dc8ba76aaeda2229940c1743c33cc0ef84b5.tar.zst
iosdc-japan-2024-albatross-a100dc8ba76aaeda2229940c1743c33cc0ef84b5.zip
Merge branch 'feat/code-hash'
Diffstat (limited to 'backend/taskqueue/processor.go')
-rw-r--r--backend/taskqueue/processor.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go
index 149ab67..5678cc8 100644
--- a/backend/taskqueue/processor.go
+++ b/backend/taskqueue/processor.go
@@ -29,8 +29,9 @@ func (p *processor) doProcessTaskCreateSubmissionRecord(
submissionID, err := p.q.CreateSubmission(ctx, db.CreateSubmissionParams{
GameID: int32(payload.GameID()),
UserID: int32(payload.UserID()),
- Code: payload.Code(),
+ Code: payload.Code,
CodeSize: int32(payload.CodeSize),
+ CodeHash: string(payload.CodeHash()),
})
if err != nil {
return nil, err
@@ -49,6 +50,7 @@ func (p *processor) doProcessTaskCompileSwiftToWasm(
type swiftcRequestData struct {
MaxDuration int `json:"max_duration_ms"`
Code string `json:"code"`
+ CodeHash string `json:"code_hash"`
}
type swiftcResponseData struct {
Status string `json:"status"`
@@ -57,7 +59,8 @@ func (p *processor) doProcessTaskCompileSwiftToWasm(
}
reqData := swiftcRequestData{
MaxDuration: 5000,
- Code: payload.Code(),
+ Code: payload.Code,
+ CodeHash: string(payload.CodeHash()),
}
reqJSON, err := json.Marshal(reqData)
if err != nil {
@@ -99,7 +102,7 @@ func (p *processor) doProcessTaskCompileWasmToNativeExecutable(
) (*TaskResultCompileWasmToNativeExecutable, error) {
type wasmcRequestData struct {
MaxDuration int `json:"max_duration_ms"`
- Code string `json:"code"`
+ CodeHash string `json:"code_hash"`
}
type wasmcResponseData struct {
Status string `json:"status"`
@@ -108,7 +111,7 @@ func (p *processor) doProcessTaskCompileWasmToNativeExecutable(
}
reqData := wasmcRequestData{
MaxDuration: 5000,
- Code: payload.Code(),
+ CodeHash: string(payload.CodeHash()),
}
reqJSON, err := json.Marshal(reqData)
if err != nil {
@@ -150,7 +153,7 @@ func (p *processor) doProcessTaskRunTestcase(
) (*TaskResultRunTestcase, error) {
type testrunRequestData struct {
MaxDuration int `json:"max_duration_ms"`
- Code string `json:"code"`
+ CodeHash string `json:"code_hash"`
Stdin string `json:"stdin"`
}
type testrunResponseData struct {
@@ -160,7 +163,7 @@ func (p *processor) doProcessTaskRunTestcase(
}
reqData := testrunRequestData{
MaxDuration: 5000,
- Code: payload.Code(),
+ CodeHash: string(payload.CodeHash()),
Stdin: payload.Stdin,
}
reqJSON, err := json.Marshal(reqData)