Permalink
Browse files

Give operations at least as long to execute as we used to

  • Loading branch information...
1 parent 14e5bcf commit a5139d41abcf63c3b03f3f8a679cceb03e4f88a3 @stuhood stuhood committed Mar 26, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/gizzard/nameserver.rb
View
5 lib/gizzard/nameserver.rb
@@ -85,7 +85,8 @@ def canonical_shard_id_map(base_prefix = "shard", table_id = nil, enum = nil)
class Nameserver
DEFAULT_PORT = 7920
DEFAULT_RETRIES = 10
- MAX_ATTEMPT_SECS = 10
+ MIN_ATTEMPT_SECS = 10
+ MAX_ATTEMPT_SECS = 30
PARALLELISM = 10
attr_reader :hosts, :logfile, :dryrun, :framed
@@ -227,7 +228,7 @@ def with_retry
STDERR.puts "\nException: #{e.class}: #{e.description rescue "(no description)"}"
STDERR.puts "Retrying #{times} more time#{'s' if times > 1}..." if times > 0
times -= 1
- sleep_time = MAX_ATTEMPT_SECS / [times, 1].max
+ sleep_time = [MIN_ATTEMPT_SECS, MAX_ATTEMPT_SECS / [times, 1].max].max
(times < 0) ? raise : (sleep(sleep_time); retry)
end

0 comments on commit a5139d4

Please sign in to comment.