From: donghyuk.yang Date: Tue, 21 Aug 2012 08:27:47 +0000 (+0900) Subject: [Title] Syncronized reading snapshot information, and avoid duplicating insert os... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98900d3d6240c737710cf777f5b5a7e5c81c10aa;p=sdk%2Ftools%2Fsdk-build.git [Title] Syncronized reading snapshot information, and avoid duplicating insert os information [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/src/pkg_server/client.rb b/src/pkg_server/client.rb index b6cfdee..8d7e70b 100644 --- a/src/pkg_server/client.rb +++ b/src/pkg_server/client.rb @@ -42,8 +42,7 @@ require "log" require "Version" require "net/ftp" $update_mutex = Mutex.new -$update_os_mutex = Mutex.new -$install_pkg_mutex = Mutex.new +$get_snapshot_mutex = Mutex.new class Client # constant @@ -104,7 +103,9 @@ class Client @log = logger end - @snapshot_path = get_lastest_snapshot(@is_server_remote) + $get_snapshot_mutex.synchronize { + @snapshot_path = get_lastest_snapshot(@is_server_remote) + } @log.info "The lastest snapshot : #{@snapshot_path}" if @snapshot_path.nil? then @log.warn "Failed to get the lastest package list" @@ -123,7 +124,6 @@ class Client public # update package list from server def update() - exists_snapshot = false if is_snapshot_exist(@snapshot_path) then @log.info "Snapshot information is already cached [#{get_pkglist_path()}]" @@ -1520,7 +1520,8 @@ class Client if File.exist? local_file_path then File.open(local_file_path, "r") do |f| f.each_line do |l| - @support_os_list.push(l.strip) + os = l.strip + if @support_os_list.index(os).nil? then @support_os_list.push(os) end end end @log.info "Get supported os infomation.. OK" @@ -1547,7 +1548,8 @@ class Client if File.exist? local_file_path then File.open(local_file_path, "r") do |f| f.each_line do |l| - @archive_pkg_list.push(l.strip) + pkg = l.strip + if @archive_pkg_list.index(pkg).nil? then @archive_pkg_list.push(pkg) end end end @log.info "Get archive package infomation.. OK"