diff --git a/lib/getstream_ruby/configuration.rb b/lib/getstream_ruby/configuration.rb index c3e5857..5130f90 100644 --- a/lib/getstream_ruby/configuration.rb +++ b/lib/getstream_ruby/configuration.rb @@ -136,14 +136,14 @@ def assign_timeouts_and_pool(options, use_env:) if use_env env_request_timeout = ENV.fetch('STREAM_REQUEST_TIMEOUT', nil) || ENV.fetch('STREAM_TIMEOUT', nil) @request_timeout = (request_timeout || timeout || env_request_timeout || 30).to_i - @max_conns_per_host = (max_conns_per_host || ENV.fetch('STREAM_MAX_CONNS_PER_HOST', nil) || 5).to_i + @max_conns_per_host = (max_conns_per_host || ENV.fetch('STREAM_MAX_CONNS_PER_HOST', nil) || 100).to_i # 25s sits under GCP SSL-proxy idle (~30s) and AWS ALB idle (60s) so # net_http_persistent drops the conn before the LB does (CHA-4943). @idle_timeout = (idle_timeout || ENV.fetch('STREAM_IDLE_TIMEOUT', nil) || 25).to_i @connect_timeout = (connect_timeout || ENV.fetch('STREAM_CONNECT_TIMEOUT', nil) || 10).to_i else @request_timeout = (request_timeout || timeout || 30).to_i - @max_conns_per_host = (max_conns_per_host || 5).to_i + @max_conns_per_host = (max_conns_per_host || 100).to_i @idle_timeout = (idle_timeout || 25).to_i @connect_timeout = (connect_timeout || 10).to_i end diff --git a/spec/connection_pooling_spec.rb b/spec/connection_pooling_spec.rb index e30da57..4321273 100644 --- a/spec/connection_pooling_spec.rb +++ b/spec/connection_pooling_spec.rb @@ -43,11 +43,11 @@ def capture_adapter_call end - it 'passes pool_size=5 to the net_http_persistent adapter' do + it 'passes pool_size=100 to the net_http_persistent adapter' do captured = capture_adapter_call { GetStreamRuby.manual(api_key: 'k', api_secret: 's') } expect(captured[:args].first).to eq(:net_http_persistent) - expect(captured[:kwargs]).to include(pool_size: 5) + expect(captured[:kwargs]).to include(pool_size: 100) end @@ -229,7 +229,7 @@ def capture_adapter_call expect(info_lines.size).to eq(1) line = info_lines.first expect(line).to include('client.initialized') - expect(line).to include('stream.client.max_conns_per_host=5') + expect(line).to include('stream.client.max_conns_per_host=100') expect(line).to include('stream.client.idle_timeout_seconds=25') expect(line).to include('stream.client.connect_timeout_seconds=10') expect(line).to include('stream.client.request_timeout_seconds=30') diff --git a/spec/getstream_ruby_spec.rb b/spec/getstream_ruby_spec.rb index 0437ad7..1fa1d40 100644 --- a/spec/getstream_ruby_spec.rb +++ b/spec/getstream_ruby_spec.rb @@ -26,7 +26,7 @@ expect(client.configuration.faraday_adapter).to be_nil expect(client.configuration.faraday_adapter_options).to eq({}) expect(client.configuration.connection_keep_alive).to eq(true) - expect(client.configuration.max_conns_per_host).to eq(5) + expect(client.configuration.max_conns_per_host).to eq(100) expect(client.configuration.idle_timeout).to eq(25) expect(client.configuration.connect_timeout).to eq(10) expect(client.configuration.request_timeout).to eq(30)