diff options
author | Steve Kemp <steve@steve.org.uk> | 2013-05-14 14:19:17 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2013-05-14 14:19:17 +0100 |
commit | 22c1f94f6f4ac1feb9bf55bcbc26c5a3d34077ed (patch) | |
tree | 08529432d6bb13651bb988c7cc7dfadcf66f98ab /lib | |
parent | 42692b16efed467a149152077b9856431107a776 (diff) |
We only sleep between tests if we saw a failure.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/worker.rb | 16 |
1 files changed, 12 insertions, 4 deletions
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 # |