aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/taskqueue/processor.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-05 22:03:54 +0900
committernsfisis <nsfisis@gmail.com>2025-09-05 22:04:06 +0900
commitbd2ebe9396475632908b23d8263be70166197dc2 (patch)
tree21d2ad6f4e106aaa881d66544c27ccee2a96b970 /backend/taskqueue/processor.go
parent3022b45715b9aabb6f54e5e19429c6b06abc1afd (diff)
downloadiosdc-japan-2025-albatross-bd2ebe9396475632908b23d8263be70166197dc2.tar.gz
iosdc-japan-2025-albatross-bd2ebe9396475632908b23d8263be70166197dc2.tar.zst
iosdc-japan-2025-albatross-bd2ebe9396475632908b23d8263be70166197dc2.zip
feat(worker-swift): compile and run in one request
Diffstat (limited to 'backend/taskqueue/processor.go')
-rw-r--r--backend/taskqueue/processor.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go
index 8dadfdf..c4cf60b 100644
--- a/backend/taskqueue/processor.go
+++ b/backend/taskqueue/processor.go
@@ -3,6 +3,7 @@ package taskqueue
import (
"bytes"
"context"
+ "crypto/md5"
"encoding/json"
"fmt"
"net/http"
@@ -16,6 +17,7 @@ func newProcessor() processor {
type testrunRequestData struct {
Code string `json:"code"`
+ CodeHash string `json:"code_hash"`
Stdin string `json:"stdin"`
MaxDuration int `json:"max_duration_ms"`
}
@@ -32,6 +34,7 @@ func (p *processor) doProcessTaskRunTestcase(
) (*TaskResultRunTestcase, error) {
reqData := testrunRequestData{
Code: payload.Code,
+ CodeHash: calcCodeHash(payload.Code),
Stdin: payload.Stdin,
MaxDuration: 5000,
}
@@ -64,3 +67,7 @@ func (p *processor) doProcessTaskRunTestcase(
Stderr: resData.Stderr,
}, nil
}
+
+func calcCodeHash(code string) string {
+ return fmt.Sprintf("%x", md5.Sum([]byte(code)))
+}