events: properly publish abort events

I think this should avoid cases of the "Abort" button sticking around.
This commit is contained in:
Tudor Brindus 2023-12-25 16:46:59 -05:00 committed by Tudor Brindus
parent c126f07fe7
commit 356b146f37
3 changed files with 4 additions and 3 deletions

View File

@ -476,8 +476,8 @@ class JudgeHandler(ZlibPacketHandler):
self._free_self(packet)
if Submission.objects.filter(id=packet['submission-id']).update(status='AB', result='AB', points=0):
event.post('sub_%s' % Submission.get_id_secret(packet['submission-id']), {'type': 'aborted-submission'})
self._post_update_submission(packet['submission-id'], 'terminated', done=True)
event.post('sub_%s' % Submission.get_id_secret(packet['submission-id']), {'type': 'aborted'})
self._post_update_submission(packet['submission-id'], 'aborted', done=True)
json_log.info(self._make_json_log(packet, action='aborted', finish=True, result='AB'))
else:
logger.warning('Unknown submission: %s', packet['submission-id'])

View File

@ -119,5 +119,5 @@ def abort_submission(submission):
# and returns a bad-request, the submission is not falsely shown as "Aborted" when it will still be judged.
if not response.get('judge-aborted', True):
Submission.objects.filter(id=submission.id).update(status='AB', result='AB', points=0)
event.post('sub_%s' % Submission.get_id_secret(submission.id), {'type': 'aborted-submission'})
event.post('sub_%s' % Submission.get_id_secret(submission.id), {'type': 'aborted'})
_post_update_submission(submission, done=True)

View File

@ -38,6 +38,7 @@
"{{ EVENT_DAEMON_LOCATION }}", "{{ EVENT_DAEMON_POLL_LOCATION }}",
['sub_{{ submission.id_secret }}'], {{ last_msg }}, function (message) {
switch (message.type) {
case 'aborted':
case 'internal-error':
case 'grading-end':
case 'compile-error':