diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-04-30 09:28:44 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-04-30 09:28:44 +0100 |
commit | aab2b13506412b88d0921c528905464f78310123 (patch) | |
tree | d39dcabf8bd6a00054c4e9c66d9267aed0e0477b /lib | |
parent | 5d3eb9c24c9a4cffcdea508ef4870ed137a54d0a (diff) |
If a test is skipped we don't need to sleep.
If a test fails then we sleep for a small amount of time, two seconds
by default, before repeating it.
This delay is not required for tests that explicitly disable themselves.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/worker.rb | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb index 7910a29..3425881 100644 --- a/lib/custodian/worker.rb +++ b/lib/custodian/worker.rb @@ -198,21 +198,37 @@ module Custodian end # - # Some of our routers/hosts don't like being hammered. + # Some targets won't like being hammed by multiple tests + # in a short period of time. Since we're hitting a failed + # device we're going to give it a little sleep. # - # We delay before re-testing, but we only do this if - # we're not on the last count. + # In theory this stops us from hammering a semi-alive + # device. In practice we only reach this point if at least + # one test has failed, and if a test is failing then it probably + # failed due to a timeout - which is 30 seconds by default - + # so the extra sleep doesn't really gain us much. + # + # + # Anyway: The intention here is that if a test passes then + # there will, things will clear, and all is well. + # + # If the test fails we'll sleep a while and retry + # but no more than "@retry_count" times. # - # The intention here is that if the test passes then there will - # be no delay. If the test fails then we'll sleep. # if (run == true) && (@retry_delay > 0) && (count < @retry_count) - log_message("Sleeping for #{@retry_delay} seconds before retry. Failure was: #{test.error}") - sleep(@retry_delay) + + # + # If the test disabled itself then we don't need to delay + # + unless( result == Custodian::TestResult::TEST_SKIPPED) + log_message("Delaying re-test by #{@retry_delay} seconds due to failure - : #{test.error}") + sleep(@retry_delay) + end end # - # Increase the log of times we've repeated the test. + # Increase the count of times we've repeated the test. # count += 1 end |