Sha256: 00897f3248aa3049231d56ad394df895c84d196058de694ef1a4a77257a3541a
Contents?: true
Size: 481 Bytes
Versions: 1
Compression:
Stored size: 481 Bytes
Contents
# frozen_string_literal: true class EzClient::PersistentClientRegistry def initialize self.registry = {} end def for(url, timeout:) cleanup_registry! uri = HTTP::URI.parse(url) registry[uri.origin] ||= EzClient::PersistentClient.new(uri.origin, timeout) end private attr_accessor :registry def cleanup_registry! registry.delete_if do |_key, value| EzClient.get_time - value.last_request_at >= value.keep_alive_timeout end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ezclient-1.5.0 | lib/ezclient/persistent_client_registry.rb |