From 22c1f94f6f4ac1feb9bf55bcbc26c5a3d34077ed Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 14 May 2013 14:19:17 +0100 Subject: We only sleep between tests if we saw a failure. --- lib/custodian/worker.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/custodian') diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb index 90e8e99..38e356c 100644 --- a/lib/custodian/worker.rb +++ b/lib/custodian/worker.rb @@ -175,7 +175,7 @@ module Custodian # # We stop the execution on a single success. # - while ( ( count < @retry_count ) && ( result == false ) ) + while ( ( count < ( @retry_count + 1 ) ) && ( result == false ) ) log_message( "Running test - [#{count}/#{@retry_count}]" ) @@ -190,17 +190,25 @@ module Custodian do_clear( test ) success = true end - count += 1 # # Some of our routers don't like being hammered. # - # We delay before re-testing. + # We delay before re-testing, but we only do this if + # we're not on the first count. + # + # The intention here is that if the test passes then there will + # be no delay. If the test fails then we'll sleep. # - if ( @retry_delay > 0 ) + if ( ( @retry_delay > 0 ) && ( count != 1 ) ) puts "Sleeping for #{@retry_delay} seconds to allow cool-down" sleep( @retry_delay ) end + + # + # Increase count. + # + count += 1 end # -- cgit v1.2.1