ensure database connection removal activated again

This commit is contained in:
Ralf Teusner
2015-11-10 15:04:21 +01:00
parent e927a39041
commit b1733d1a16

View File

@ -174,22 +174,22 @@ class DockerClient
We need to start a second thread to kill the websocket connection, We need to start a second thread to kill the websocket connection,
as it is impossible to determine whether further input is requested. as it is impossible to determine whether further input is requested.
""" """
@thread = Thread.new do begin
#begin @thread = Thread.new do
timeout = @execution_environment.permitted_execution_time.to_i # seconds timeout = @execution_environment.permitted_execution_time.to_i # seconds
sleep(timeout) sleep(timeout)
if container.status != :returned if container.status != :returned
Rails.logger.info('Killing container after timeout of ' + timeout.to_s + ' seconds.') Rails.logger.info('Killing container after timeout of ' + timeout.to_s + ' seconds.')
# send timeout to the tubesock socket # send timeout to the tubesock socket
if(@tubesock) if(@tubesock)
@tubesock.send_data JSON.dump({'cmd' => 'timeout'}) @tubesock.send_data JSON.dump({'cmd' => 'timeout'})
end
kill_container(container)
end end
kill_container(container) end
end ensure
# ensure # guarantee that the thread is releasing the DB connection after it is done
# #guarantee that the thread is releasing the DB connection after it is done ActiveRecord::Base.connectionpool.releaseconnection
# ActiveRecord::Base.connectionpool.releaseconnection
# end
end end
end end