fixed saving run results. also fixed websocket closing.

This commit is contained in:
Ralf Teusner
2017-03-24 18:47:30 +01:00
parent 5aeda988b7
commit bdbc372c0c
2 changed files with 14 additions and 5 deletions

View File

@ -255,6 +255,12 @@ class DockerClient
if(@tubesock)
@tubesock.send_data JSON.dump({'cmd' => 'timeout'})
end
if(@socket)
@socket.send('#timeout')
#sleep one more second to ensure that the message reaches the submissions_controller.
sleep(1)
@socket.close
end
kill_container(container)
end
#ensure
@ -274,6 +280,7 @@ class DockerClient
Rails.logger.debug('exiting container ' + container.to_s)
# exit the timeout thread if it is still alive
exit_thread_if_alive
@socket.close
# if we use pooling and recylce the containers, put it back. otherwise, destroy it.
(DockerContainerPool.config[:active] && RECYCLE_CONTAINERS) ? self.class.return_container(container, @execution_environment) : self.class.destroy_container(container)
end