lib/httpx/resolver/system.rb in httpx-1.1.0 vs lib/httpx/resolver/system.rb in httpx-1.1.1
- old
+ new
@@ -162,11 +162,12 @@
end
def async_resolve(connection, hostname, scheme)
families = connection.options.ip_families
log { "resolver: query for #{hostname}" }
- resolve_timeout = @timeouts[connection.origin.host].first
+ timeouts = @timeouts[connection.origin.host]
+ resolve_timeout = timeouts.first
Thread.start do
Thread.current.report_on_exception = false
begin
addrs = if resolve_timeout
@@ -189,9 +190,11 @@
@pipe_write.putc(DONE) unless @pipe_write.closed?
end
end
rescue StandardError => e
if e.is_a?(Timeout::Error)
+ timeouts.shift
+ retry unless timeouts.empty?
e = ResolveTimeoutError.new(resolve_timeout, e.message)
e.set_backtrace(e.backtrace)
end
@pipe_mutex.synchronize do
families.each do |family|