Prevent duplicated WebSocket close for client_kill

Our investigation in CODEOCEAN-TV showed that we might attempt to close the WebSocket connection twice, if learners press the stop button. With this commit, we fix that issue.
This commit is contained in:
Sebastian Serth
2023-09-08 00:16:12 +02:00
parent c6461f6bdd
commit 50a4707f65

View File

@ -242,7 +242,7 @@ class SubmissionsController < ApplicationController
Sentry.capture_exception(e)
extract_durations(e)
ensure
close_client_connection(client_socket)
close_client_connection(client_socket) unless client_kill
save_testrun_output 'run'
Sentry.capture_message('Execution got terminated by client', extra: {websocket: @tubesock_debug_events, submission: @submission.id}) if @testrun[:status] == :terminated_by_client && !client_kill
end