117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/dash/sshkit_with_ext.rb', line 117
def with_dns_retry(hostname, retries: config.dns_retries, base: DNS_RETRY_BASE, max_sleep: DNS_RETRY_MAX, jitter: DNS_RETRY_JITTER)
attempts = 0
begin
attempts += 1
yield
rescue => error
raise unless retryable_dns_error?(error) && attempts <= retries
delay = dns_retry_sleep(attempts, base: base, jitter: jitter, max_sleep: max_sleep)
SSHKit.config.output.warn("Retrying DNS for #{hostname} (attempt #{attempts}/#{retries}) in #{format("%0.2f", delay)}s: #{error.message}")
sleep delay
retry
end
end
|