Skip to content

Remove transaction when resolving internal error. #2888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 39 additions & 40 deletions webapp/src/Controller/Jury/InternalErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,48 +167,47 @@ public function handleAction(Request $request, ?Profiler $profiler, int $errorId
flush();
};
return $this->streamResponse($this->requestStack, function () use ($progressReporter, $internalError) {
$this->em->wrapInTransaction(function () use ($progressReporter, $internalError) {
$internalError->setStatus(InternalErrorStatusType::STATUS_RESOLVED);
$this->dj->setInternalError(
$internalError->getDisabled(),
$internalError->getContest(),
true
);

$this->dj->auditlog('internal_error', $internalError->getErrorid(),
sprintf('internal error: %s', InternalErrorStatusType::STATUS_RESOLVED));

$affectedJudgings = $internalError->getAffectedJudgings();
if (!$affectedJudgings->isEmpty()) {
$skipped = [];
$rejudging = $this->rejudgingService->createRejudging(
'Internal Error ' . $internalError->getErrorid() . ' resolved',
JudgeTask::PRIORITY_DEFAULT,
$affectedJudgings->getValues(),
false,
0,
0,
null,
$skipped,
$progressReporter);
if ($rejudging === null) {
$this->addFlash('warning', 'All submissions that are affected by this internal error are already part of another rejudging.');
} else {
$rejudgingUrl = $this->generateUrl('jury_rejudging', ['rejudgingId' => $rejudging->getRejudgingid()]);
$internalErrorUrl = $this->generateUrl('jury_internal_error', ['errorId' => $internalError->getErrorid()]);
$message = sprintf(
'Rejudging <a href="%s">r%d</a> created for internal error <a href="%s">%d</a>.',
$rejudgingUrl,
$rejudging->getRejudgingid(),
$internalErrorUrl,
$internalError->getErrorid()
);
$progressReporter(100, '', $message);
}
$internalError->setStatus(InternalErrorStatusType::STATUS_RESOLVED);
$this->dj->setInternalError(
$internalError->getDisabled(),
$internalError->getContest(),
true
);
$this->em->flush();

$this->dj->auditlog('internal_error', $internalError->getErrorid(),
sprintf('internal error: %s', InternalErrorStatusType::STATUS_RESOLVED));

$affectedJudgings = $internalError->getAffectedJudgings();
if (!$affectedJudgings->isEmpty()) {
$skipped = [];
$rejudging = $this->rejudgingService->createRejudging(
'Internal Error ' . $internalError->getErrorid() . ' resolved',
JudgeTask::PRIORITY_DEFAULT,
$affectedJudgings->getValues(),
false,
0,
0,
null,
$skipped,
$progressReporter);
if ($rejudging === null) {
$this->addFlash('warning', 'All submissions that are affected by this internal error are already part of another rejudging.');
} else {
$progressReporter(100, '', 'No affected judgings.');
$rejudgingUrl = $this->generateUrl('jury_rejudging', ['rejudgingId' => $rejudging->getRejudgingid()]);
$internalErrorUrl = $this->generateUrl('jury_internal_error', ['errorId' => $internalError->getErrorid()]);
$message = sprintf(
'Rejudging <a href="%s">r%d</a> created for internal error <a href="%s">%d</a>.',
$rejudgingUrl,
$rejudging->getRejudgingid(),
$internalErrorUrl,
$internalError->getErrorid()
);
$progressReporter(100, '', $message);
}
});
} else {
$progressReporter(100, '', 'No affected judgings.');
}
});
}

Expand Down
Loading