lib/httpx/altsvc.rb in httpx-0.17.0 vs lib/httpx/altsvc.rb in httpx-0.18.0

- old
+ new

@@ -8,17 +8,17 @@ @altsvcs = Hash.new { |h, k| h[k] = [] } module_function def cached_altsvc(origin) - now = Process.clock_gettime(Process::CLOCK_MONOTONIC) + now = Utils.now @altsvc_mutex.synchronize do lookup(origin, now) end end def cached_altsvc_set(origin, entry) - now = Process.clock_gettime(Process::CLOCK_MONOTONIC) + now = Utils.now @altsvc_mutex.synchronize do return if @altsvcs[origin].any? { |altsvc| altsvc["origin"] == entry["origin"] } entry["TTL"] = Integer(entry["ma"]) + now if entry.key?("ma") @altsvcs[origin] << entry