Addressing code review comments.
@@ -5473,6 +5473,13 @@ HOSTS
return
end
+ if SCALE_LOCK.locked?
+ Djinn.log_debug("Another thread is already working with the InfrastructureManager.")
+ return
+ end
+
+ Thread.new {
+ SCALE_LOCK.synchronize {
# Look through an array of autoscaled nodes and check if any of the
# machines are not running any AppServers and need to be downscaled.
get_autoscaled_nodes.reverse_each { |node|
@@ -5506,7 +5513,8 @@ HOSTS
num_terminated = terminate_node_from_deployment(node_to_remove)
num_scaled_down += num_terminated
}
- @last_scaling_time = Time.now.to_i
+ }
+ }
end
# Removes the specified node from the deployment and terminates
