Prevent parallel execution of run and test during RfC creation

* Otherwise, the output of both might be mixed and saved incorrectly for the RfC
This commit is contained in:
Sebastian Serth
2021-10-31 12:57:23 +01:00
parent 475aa8c512
commit 1e7cf1c622

View File

@ -117,12 +117,10 @@ class RequestForCommentsController < ApplicationController
respond_to do |format| respond_to do |format|
if @request_for_comment.save if @request_for_comment.save
# create thread here and execute tests. A run is triggered from the frontend and does not need to be handled here. # execute the tests here and wait until they finished.
Thread.new do # As the same runner is used for the score and test run, no parallelization is possible
switch_locale { @request_for_comment.submission.calculate_score } # A run is triggered from the frontend and does not need to be handled here.
ensure @request_for_comment.submission.calculate_score
ActiveRecord::Base.connection_pool.release_connection
end
format.json { render :show, status: :created, location: @request_for_comment } format.json { render :show, status: :created, location: @request_for_comment }
else else
format.html { render :new } format.html { render :new }