release database connections after thread termination of the "kill after timeout thread"

This commit is contained in:
Ralf Teusner
2015-11-08 12:39:42 +01:00
parent 23645a60b1
commit 1aa877d506

View File

@ -174,6 +174,7 @@ class DockerClient
as it is impossible to determine whether further input is requested.
"""
@thread = Thread.new do
begin
timeout = @execution_environment.permitted_execution_time.to_i # seconds
sleep(timeout)
if container.status != :returned
@ -184,6 +185,10 @@ class DockerClient
end
kill_container(container)
end
ensure
#guarantee that the thread is releasing the DB connection after it is done
ActiveRecord::Base.connectionpool.releaseconnection
end
end
end