Show correct timeout message on timeout. Do not show a message on valid exit.

This commit is contained in:
Ralf Teusner
2015-10-21 17:18:28 +02:00
parent 889d7562f9
commit 30d0270744
3 changed files with 17 additions and 10 deletions

View File

@ -12,6 +12,7 @@ class DockerClient
attr_reader :container
attr_reader :socket
attr_accessor :tubesock
def self.check_availability!
Timeout.timeout(config[:connection_timeout]) { Docker.version }
@ -176,6 +177,10 @@ class DockerClient
sleep(timeout)
if container.status != :returned
Rails.logger.info("Killing container after timeout of " + timeout.to_s + " seconds.")
# send timeout to the tubesock socket
if(@tubesock)
@tubesock.send_data JSON.dump({'cmd' => 'timeout'})
end
kill_container(container)
end
end