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 | e7fcf6442a5e5970c95755b4947d88f4a2eeeda3 (patch) | |
tree | 86ec71baf40bd0c4c6fea34b9bc2bcacc9977b6d /lib/custodian | |
parent | 2c5ca798e2f7ccdd56b7f37a8834b655686ebdba (diff) |
We only sleep between tests if we saw a failure.
Diffstat (limited to 'lib/custodian')
-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 # |