Revert "Use switch_locale instead of I18n.with_locale directly"

This reverts commit 125c342f35.
This commit is contained in:
Ralf Teusner
2021-08-05 11:55:54 +02:00
parent b4df53ff54
commit 2c08e270e7
2 changed files with 39 additions and 33 deletions

View File

@ -366,13 +366,16 @@ class SubmissionsController < ApplicationController
# the score_submission call will end up calling docker exec, which is blocking.
# to ensure responsiveness, we therefore open a thread here.
current_locale = I18n.locale
Thread.new do
tubesock.send_data JSON.dump(score_submission(@submission))
I18n.with_locale(current_locale) do
tubesock.send_data JSON.dump(score_submission(@submission))
# To enable hints when scoring a submission, uncomment the next line:
# send_hints(tubesock, StructuredError.where(submission: @submission))
# To enable hints when scoring a submission, uncomment the next line:
# send_hints(tubesock, StructuredError.where(submission: @submission))
tubesock.send_data JSON.dump({'cmd' => 'exit'})
tubesock.send_data JSON.dump({'cmd' => 'exit'})
end
ensure
ActiveRecord::Base.connection_pool.release_connection
end