summaryrefslogtreecommitdiff
path: root/lib/custodian/worker.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-05-14 13:39:56 +0100
committerSteve Kemp <steve@steve.org.uk>2013-05-14 13:39:56 +0100
commit9ad500d31090daf680e6760ece333a9164f653b6 (patch)
treec84d923df43f12f3dd2cc869de6a5b06da7d67ea /lib/custodian/worker.rb
parent8b59f320ef19f6470ce0d5a7229a8be58a9f7180 (diff)
Allow retry-behaviour to be tweaked.
We can now sleep between retesting, and we configure the number of repeats via the configuration file.
Diffstat (limited to 'lib/custodian/worker.rb')
-rw-r--r--lib/custodian/worker.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb
index 0255134..432b3d4 100644
--- a/lib/custodian/worker.rb
+++ b/lib/custodian/worker.rb
@@ -54,6 +54,11 @@ module Custodian
#
attr_reader :retry_count
+ #
+ # Should we sleep between repeated tests?
+ #
+ attr_reader :retry_delay
+
#
# The log-file object
@@ -87,7 +92,10 @@ module Custodian
@settings = settings
# How many times to repeat a failing test
- @retry_count=5
+ @retry_count=@settings.retries()
+
+ # Should we sleep between repeated tests?
+ @retry_delay = @settings.retry_delay()
end
@@ -183,6 +191,16 @@ module Custodian
success = true
end
count += 1
+
+ #
+ # Some of our routers don't like being hammered.
+ #
+ # We delay before re-testing.
+ #
+ if ( @retry_delay > 0 )
+ puts "Sleeping for #{@retry_delay} seconds to allow cooldown"
+ sleep( @retry_delay )
+ end
end
#