aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/taskqueue/processor.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/taskqueue/processor.go')
-rw-r--r--backend/taskqueue/processor.go7
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)))
}