From 1e7cf1c6228cfe541a1682a71e2c3aab16cf72d1 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 31 Oct 2021 12:57:23 +0100 Subject: [PATCH] Prevent parallel execution of run and test during RfC creation * Otherwise, the output of both might be mixed and saved incorrectly for the RfC --- app/controllers/request_for_comments_controller.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 4592d57d..c673f842 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -117,12 +117,10 @@ class RequestForCommentsController < ApplicationController respond_to do |format| 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. - Thread.new do - switch_locale { @request_for_comment.submission.calculate_score } - ensure - ActiveRecord::Base.connection_pool.release_connection - end + # execute the tests here and wait until they finished. + # As the same runner is used for the score and test run, no parallelization is possible + # A run is triggered from the frontend and does not need to be handled here. + @request_for_comment.submission.calculate_score format.json { render :show, status: :created, location: @request_for_comment } else format.html { render :new }