Implement workaroud for double render error
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
This commit is contained in:

committed by
Sebastian Serth

parent
347e4728a0
commit
28f8de1a93
@ -192,22 +192,22 @@ class SubmissionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
# TODO do we need this thread? If so, how to fix double render? (to reproduce: remove .join and run)
|
||||||
Thread.new do
|
Thread.new do
|
||||||
hijack do |tubesock|
|
hijack do |tubesock|
|
||||||
if @embed_options[:disable_run]
|
if @embed_options[:disable_run]
|
||||||
kill_socket(tubesock)
|
kill_socket(tubesock)
|
||||||
return
|
else
|
||||||
end
|
@container_execution_time = @submission.run(sanitize_filename) do |container, socket|
|
||||||
@container_execution_time = @submission.run(sanitize_filename) do |container, socket|
|
@waiting_for_container_time = container.waiting_time
|
||||||
@waiting_for_container_time = container.waiting_time
|
handle_websockets(tubesock, container, socket)
|
||||||
handle_websockets(tubesock, container, socket)
|
end
|
||||||
|
save_run_output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# save the output of this "run" as a "testrun" (scoring runs are saved in submission_scoring.rb)
|
|
||||||
save_run_output
|
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_pool.release_connection
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
end
|
end.join
|
||||||
# TODO determine if this is necessary
|
# TODO determine if this is necessary
|
||||||
# unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
|
# unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
|
||||||
# Thread.new do
|
# Thread.new do
|
||||||
@ -228,6 +228,7 @@ class SubmissionsController < ApplicationController
|
|||||||
tubesock.close
|
tubesock.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# save the output of this "run" as a "testrun" (scoring runs are saved in submission_scoring.rb)
|
||||||
def save_run_output
|
def save_run_output
|
||||||
return if @output.blank?
|
return if @output.blank?
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user