release database connections after thread termination of the "kill after timeout thread"
This commit is contained in:
@ -174,6 +174,7 @@ class DockerClient
|
|||||||
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
|
@thread = Thread.new do
|
||||||
|
begin
|
||||||
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
|
||||||
@ -184,6 +185,10 @@ class DockerClient
|
|||||||
end
|
end
|
||||||
kill_container(container)
|
kill_container(container)
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
#guarantee that the thread is releasing the DB connection after it is done
|
||||||
|
ActiveRecord::Base.connectionpool.releaseconnection
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user