use fake time instead of real time when measuring against inservice_time_allowed
This commit is contained in:
		
							parent
							
								
									1b5acf6ede
								
							
						
					
					
						commit
						c493f2e188
					
				@ -97,20 +97,10 @@ module AwsMissingTools
 | 
				
			|||||||
      @group.auto_scaling_instances.each do |instance|
 | 
					      @group.auto_scaling_instances.each do |instance|
 | 
				
			||||||
        time_taken = 0
 | 
					        time_taken = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        begin
 | 
					 | 
				
			||||||
          Timeout::timeout(@opts[:inservice_time_allowed]) do
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        until all_instances_inservice_for_time_period?(@group.load_balancers, INSERVICE_POLLING_TIME)
 | 
					        until all_instances_inservice_for_time_period?(@group.load_balancers, INSERVICE_POLLING_TIME)
 | 
				
			||||||
          puts "#{time_taken} seconds have elapsed while waiting for all instances to be InService for a minimum of #{@opts[:min_inservice_time]} seconds."
 | 
					          puts "#{time_taken} seconds have elapsed while waiting for all instances to be InService for a minimum of #{@opts[:min_inservice_time]} seconds."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              time_taken += INSERVICE_POLLING_TIME
 | 
					          if time_taken >= @opts[:inservice_time_allowed]
 | 
				
			||||||
              sleep INSERVICE_POLLING_TIME
 | 
					 | 
				
			||||||
            end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            puts "\nThe new instance was found to be healthy; one old instance will now be removed from the load balancers."
 | 
					 | 
				
			||||||
            deregister_instance instance.ec2_instance, @group.load_balancers
 | 
					 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
        rescue Timeout::Error => e
 | 
					 | 
				
			||||||
            puts "\nDuring the last #{time_taken} seconds, a new AutoScaling instance failed to become healthy."
 | 
					            puts "\nDuring the last #{time_taken} seconds, a new AutoScaling instance failed to become healthy."
 | 
				
			||||||
            puts "The following settings were changed and will not be changed back by this script:\n"
 | 
					            puts "The following settings were changed and will not be changed back by this script:\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -122,7 +112,14 @@ module AwsMissingTools
 | 
				
			|||||||
            end
 | 
					            end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            raise
 | 
					            raise
 | 
				
			||||||
 | 
					          else
 | 
				
			||||||
 | 
					            time_taken += INSERVICE_POLLING_TIME
 | 
				
			||||||
 | 
					            sleep INSERVICE_POLLING_TIME
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        puts "\nThe new instance was found to be healthy; one old instance will now be removed from the load balancers."
 | 
				
			||||||
 | 
					        deregister_instance instance.ec2_instance, @group.load_balancers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        puts "Sleeping for the ELB Timeout period of #{@opts[:elb_timeout]}"
 | 
					        puts "Sleeping for the ELB Timeout period of #{@opts[:elb_timeout]}"
 | 
				
			||||||
        sleep @opts[:elb_timeout]
 | 
					        sleep @opts[:elb_timeout]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user