Module: Iudex::AsyncHTTPClient

Includes:
RJack::AsyncHTTPClient
Defined in:
lib/iudex-async-httpclient.rb,
lib/iudex-async-httpclient/base.rb

Constant Summary collapse

VERSION =
'1.4.0'
LIB_DIR =

:nodoc:

File.dirname( __FILE__ )

Class Method Summary collapse

Class Method Details

.create_client(opts = {}) ⇒ Object



34
35
36
# File 'lib/iudex-async-httpclient.rb', line 34

def self.create_client( opts = {} )
  Client.new( AsyncHttpClient.new( create_client_config( opts ) ) )
end

.create_client_config(opts = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/iudex-async-httpclient.rb', line 38

def self.create_client_config( opts = {} )

  cfg = { :connection_timeout_in_ms      => 3_000,
          :idle_connection_timeout_in_ms => 6_000,
          :request_timeout_in_ms         => 5_000,
          :max_request_retry             =>     1,
          :maximum_connections_total     =>   100,
          :maximum_connections_per_host  =>     2,
          :follow_redirects              => false,
          :maximum_number_of_redirects   =>     6,
          :compression_enabled           =>  true }

  cfg = cfg.merge( opts )

  cfg = Hooker.merge( [ :iudex, :async_httpclient ], cfg )

  RJack::AsyncHTTPClient.build_client_config( cfg )
end