Refactor listing files to be independent of exiting runners

Previously, we were always fetching files, even if not required (e.g., for score runs). Now, we reduce the number of file listings and use a dedicated callback.
This commit is contained in:
Sebastian Serth
2023-02-15 23:24:55 +01:00
parent e96eda69d7
commit e9cf79085a
2 changed files with 23 additions and 8 deletions

View File

@ -178,7 +178,7 @@ class SubmissionsController < ApplicationController
send_and_store client_socket, message
end
runner_socket.on :exit do |exit_code, files|
runner_socket.on :exit do |exit_code|
@testrun[:exit_code] = exit_code
exit_statement =
if @testrun[:output].empty? && exit_code.zero?
@ -201,6 +201,10 @@ class SubmissionsController < ApplicationController
@testrun[:status] = :out_of_memory
end
# The client connection will be closed once the file listing finished.
end
runner_socket.on :files do |files|
downloadable_files, = convert_files_json_to_files files
if downloadable_files.present?
js_tree = FileTree.new(downloadable_files).to_js_tree