lib/httpx/resolver/native.rb in httpx-0.17.0 vs lib/httpx/resolver/native.rb in httpx-0.18.0
- old
+ new
@@ -45,10 +45,12 @@
DNS_PORT = 53
def_delegator :@connections, :empty?
+ attr_reader :state
+
def initialize(options)
@options = Options.new(options)
@ns_index = 0
@resolver_options = DEFAULTS.merge(@options.resolver_options)
@nameserver = @resolver_options[:nameserver]
@@ -118,11 +120,11 @@
end
def timeout
return if @connections.empty?
- @start_timeout = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ @start_timeout = Utils.now
hosts = @queries.keys
@timeouts.values_at(*hosts).reject(&:empty?).map(&:first).min
end
private
@@ -138,10 +140,10 @@
end
def do_retry
return if @queries.empty?
- loop_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_timeout
+ loop_time = Utils.elapsed_time(@start_timeout)
connections = []
queries = {}
while (query = @queries.shift)
h, connection = query
host = connection.origin.host