summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/custodian/custodian.cfg18
-rw-r--r--lib/custodian/settings.rb20
-rw-r--r--lib/custodian/worker.rb20
3 files changed, 57 insertions, 1 deletions
diff --git a/etc/custodian/custodian.cfg b/etc/custodian/custodian.cfg
index 3f6be17..2887bc7 100644
--- a/etc/custodian/custodian.cfg
+++ b/etc/custodian/custodian.cfg
@@ -58,6 +58,24 @@
##
+##
+#
+# The number of times to repeat a test before regarding it
+# as failed
+#
+# retries = 5
+#
+##
+
+##
+#
+# Should we sleep before repeating tests? If so this is the
+# number of second to sleep
+#
+# retry_delay = 1
+#
+##
+
##
# The timeout period to use for tests
diff --git a/lib/custodian/settings.rb b/lib/custodian/settings.rb
index b37e9e4..34a54a6 100644
--- a/lib/custodian/settings.rb
+++ b/lib/custodian/settings.rb
@@ -90,6 +90,26 @@ module Custodian
+ #
+ # The number of times to re-execute a test before
+ # considering it is failed.
+ #
+ def retries
+ _load() unless( _loaded? )
+
+ @settings['retries' ] || 5
+ end
+
+
+ #
+ # Should we sleep before repeating tests?
+ #
+ def retry_delay
+ _load() unless( _loaded? )
+
+ @settings['retry_delay'] || 0
+ end
+
#
# The beanstalkd server address
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
#