Class: AmplitudeExperiment::PersistentHttpClient
- Inherits:
-
Object
- Object
- AmplitudeExperiment::PersistentHttpClient
- Defined in:
- lib/experiment/persistent_http_client.rb
Overview
Persist Http Client to reuse connection and reduce IO. Connections are shared by api key.
WARNING: these connections are not safe for concurrent requests. Callers must synchronize requests per connection.
Defined Under Namespace
Classes: ConnectionManager
Constant Summary collapse
- DEFAULT_OPTIONS =
{ read_timeout: 80 }.freeze
Class Method Summary collapse
-
.get(url, options, api_key) ⇒ Object
url: URI / String options: any options that Net::HTTP.new accepts api_key: the deployment key for ensuring different deployments don’t share connections.
Class Method Details
.get(url, options, api_key) ⇒ Object
url: URI / String options: any options that Net::HTTP.new accepts api_key: the deployment key for ensuring different deployments don’t share connections.
15 16 17 18 |
# File 'lib/experiment/persistent_http_client.rb', line 15 def get(url, , api_key) uri = url.is_a?(URI) ? url : URI(url) connection_manager.get_client(uri, , api_key) end |