Skip to content

Commit b14ea84

Browse files
committed
Create new QueueTask when enabling JudgeTask
When the QueueTask is already processed before the arrival of the upstream verdict, the udpated JudgeTask will never be picked up by a judge daemon. To ensure that the interesting run is actually picked up, create a new QueueTask. Note that, in case of an already existing unprocessed queue task, this should not break anything.
1 parent 8a6ba14 commit b14ea84

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

webapp/src/Service/ExternalContestSourceService.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use App\Entity\JudgeTask;
3131
use App\Entity\Language;
3232
use App\Entity\Problem;
33+
use App\Entity\QueueTask;
3334
use App\Entity\Submission;
3435
use App\Entity\SubmissionSource;
3536
use App\Entity\Team;
@@ -1866,6 +1867,7 @@ protected function importRun(Event $event, EventData $data): void
18661867
$priority = $this->getAnalystRunPriority($run);
18671868
if ($priority !== null) {
18681869
// Make the judgetask valid and assign running priority if no judgehost has picked it up yet.
1870+
$submission = $externalJudgement->getSubmission();
18691871
$this->em->createQueryBuilder()
18701872
->update(JudgeTask::class, 'jt')
18711873
->set('jt.valid', true)
@@ -1874,9 +1876,17 @@ protected function importRun(Event $event, EventData $data): void
18741876
->andWhere('jt.submission = :submission')
18751877
->andWhere('jt.judgehost IS NULL')
18761878
->setParameter('testcase_id', $testcase->getTestcaseid())
1877-
->setParameter('submission', $externalJudgement->getSubmission())
1879+
->setParameter('submission', $submission)
18781880
->getQuery()
18791881
->execute();
1882+
1883+
$queueTask = new QueueTask();
1884+
$queueTask->setJudging($submission->getJudgings()->first())
1885+
->setPriority($priority)
1886+
->setTeam($submission->getTeam())
1887+
->setTeamPriority((int)$submission->getSubmittime())
1888+
->setStartTime(null);
1889+
$this->em->persist($queueTask);
18801890
}
18811891
}
18821892

0 commit comments

Comments
 (0)