diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-08 22:24:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-08 22:24:14 +0900 |
| commit | ba9b11647f4816ca7c4b4ffb6b9859dcc8adb639 (patch) | |
| tree | 1ea5554d0058b7f9b2944258ca7f5fa5e235a80d /backend/taskqueue | |
| parent | b3042f87c4ee79d114c63823057ee5c52dccfa12 (diff) | |
| download | iosdc-japan-2025-albatross-ba9b11647f4816ca7c4b4ffb6b9859dcc8adb639.tar.gz iosdc-japan-2025-albatross-ba9b11647f4816ca7c4b4ffb6b9859dcc8adb639.tar.zst iosdc-japan-2025-albatross-ba9b11647f4816ca7c4b4ffb6b9859dcc8adb639.zip | |
fix(backend): set unique code hash for each test case run
Diffstat (limited to 'backend/taskqueue')
| -rw-r--r-- | backend/taskqueue/processor.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go index 4566951..2809748 100644 --- a/backend/taskqueue/processor.go +++ b/backend/taskqueue/processor.go @@ -34,7 +34,7 @@ func (p *processor) doProcessTaskRunTestcase( ) (*TaskResultRunTestcase, error) { reqData := testrunRequestData{ Code: payload.Code, - CodeHash: calcCodeHash(payload.Code), + CodeHash: calcCodeHash(payload.Code, payload.TestcaseID), Stdin: payload.Stdin, MaxDuration: 30 * 1000, } @@ -68,6 +68,7 @@ func (p *processor) doProcessTaskRunTestcase( }, nil } -func calcCodeHash(code string) string { - return fmt.Sprintf("%x", md5.Sum([]byte(code))) +func calcCodeHash(code string, testcaseID int) string { + buf := make([]byte, 0, len(code)+10) + return fmt.Sprintf("%x", md5.Sum(fmt.Appendf(buf, "%s@%d", code, testcaseID))) } |
