[Title] Fixed a bug that remote server status reset to "DISCONNECTED"
authordonghee yang <donghee.yang@samsung.com>
Wed, 12 Dec 2012 14:22:39 +0000 (23:22 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Wed, 12 Dec 2012 14:22:39 +0000 (23:22 +0900)
src/build_server/RemoteBuildServer.rb

index 6e86a09d809ba64f42e5897ed2ecde919cf47e96..c395d82f0c8d5c5e99aad515d68e88c940bb7aae 100644 (file)
@@ -73,9 +73,10 @@ class RemoteBuildServer
        def update_state(db)
 
                # send
-               @status = "DISCONNECTED"
+               #@status = "DISCONNECTED"
                client = BuildCommClient.create( @ip, @port )
                if client.nil? then
+                       @status = "DISCONNECTED"
                        db.do "UPDATE remote_build_servers SET status = 'DISCONNECTED', max_job_count = 0, working_job_count = 0, waiting_job_count = 0 WHERE id = #{@id}"
                        return
                end
@@ -100,7 +101,11 @@ class RemoteBuildServer
                @working_jobs = []
                @waiting_jobs = []
                client = BuildCommClient.create( @ip, @port )
-               if client.nil? then return end
+               if client.nil? then
+                       @status = "DISCONNECTED"
+                       db.do "UPDATE remote_build_servers SET status = 'DISCONNECTED', max_job_count = 0, working_job_count = 0, waiting_job_count = 0 WHERE id = #{@id}"
+                       return
+               end
                if client.send("QUERY|JOB") then
                        result = client.read_lines do |l|
                                tok = l.split(",").map { |x| x.strip }