From 7b0ac9e3e3521dcef0c6d726b7d908b8083056d8 Mon Sep 17 00:00:00 2001 From: Nguyen Thanh Quang Date: Sun, 26 Nov 2023 11:05:15 +0700 Subject: [PATCH] :bug: (wrong condition impairing producer functionalities): --- worker/runner.go | 3 --- worker/worker.go | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/worker/runner.go b/worker/runner.go index c65a1d6..742764f 100644 --- a/worker/runner.go +++ b/worker/runner.go @@ -42,9 +42,6 @@ func (jc *JudgeRunner) Judge(sub types.Submission, ctx context.Context, announce return &types.FinalResult{Verdict: types.FinalCompileError, CompilerOutput: compOut} } fv, p, e := jc.Run(rt, sub, announce, outPath, callback, ctx) - if e != nil { - - } return &types.FinalResult{ Verdict: fv, CompilerOutput: compOut, diff --git a/worker/worker.go b/worker/worker.go index ba751d0..77e713a 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -136,13 +136,15 @@ func (w *JudgeWorker) Judge(r *_runner, sub types.Submission) { r.currentSubmission.Store(sub.ID) // TODO: immediately halt runner when getting error judge := r.Judge(sub, r.ctx, func(caseId uint16) bool { - return prod.Report(types.ResultAnnouncement, caseId) != nil + return prod.Report(types.ResultAnnouncement, caseId) == nil }, func(r types.CaseResult) bool { return prod.Report(types.ResultCase, r) == nil }) finalResult := judge() - // replace actual new line characters with \\n to avoid shattered payloads when serializing response with msgpack - finalResult.CompilerOutput = strings.ReplaceAll(finalResult.CompilerOutput, "\n", "\\n") + if finalResult != nil { + // replace actual new line characters with \\n to avoid shattered payloads when serializing response with msgpack + finalResult.CompilerOutput = strings.ReplaceAll(finalResult.CompilerOutput, "\n", "\\n") + } prod.Report(types.ResultFinal, finalResult) }