Removed useless Mutex
The mutex was introduced with the idea of having the possibility of
multiple update_node_info_cache running at the same time. Since the
design is now chnaged, and there is only one invocation and the spawn
threads are joined within the function, there is no need for this any
longer.
@@ -66,10 +66,6 @@ NODETOOL_LOCK = Mutex.new
# new nodes (it takes a long time to spawn a new VM).
SCALE_LOCK = Mutex.new
-# This lock is used to ensure only one thread is updating the cluster
-# statistics.
-STATS_LOCK = Mutex.new
-
# The name of the user to be used with reserved applications.
APPSCALE_USER = 'appscale-user@local.appscale'.freeze
@@ -1147,15 +1143,8 @@ class Djinn
# Updates our locally cached information about the CPU, memory, and disk
# usage of each machine in this AppScale deployment.
def update_node_info_cache
- # We want to have only one set of requests to be pending at each time.
- if STATS_LOCK.locked?
- Djinn.log_debug("Another thread is already updating cluster stats.")
- return
- end
-
threads = []
new_stats = []
- STATS_LOCK.synchronize {
@state_change_lock.synchronize {
@nodes.each { |node|
ip = node.private_ip
@@ -1164,7 +1153,6 @@ class Djinn
new_stats << JSON.load(get_node_stats_json(@@secret))
rescue SOAP::FaultError
Djinn.log_warn("Failed to get local status update.")
- next
end
else
threads << Thread.new {
@@ -1179,7 +1167,6 @@ class Djinn
}
end
}
- }
threads.each { |t|
t.join
new_stats << t[:new_stat] unless t[:new_stat].nil?
