module Rmega::ConnPool
Public Class Methods
connection_manager()
click to toggle source
# File lib/rmega/conn_pool.rb, line 14 def self.connection_manager synchronize do @connection_managers ||= [] # we first clear all old ones removed = @connection_managers.reject!(&:stale?) (removed || []).each(&:close_connections!) # get the manager Thread.current[:http_connection_manager] ||= self.synchronize do manager = ConnectionManager.new @connection_managers << manager manager end end end
get(url, options = {})
click to toggle source
url: URI / String options: any options that Net::HTTP.new accepts
# File lib/rmega/conn_pool.rb, line 9 def self.get(url, options = {}) uri = url.is_a?(URI) ? url : URI(url) connection_manager.get_client(uri, options) end