File tree Expand file tree Collapse file tree
rbi/lithic/internal/transport
sig/lithic/internal/transport Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,10 +146,10 @@ def initialize(
146146 api_key : ENV [ "LITHIC_API_KEY" ] ,
147147 environment : nil ,
148148 base_url : ENV [ "LITHIC_BASE_URL" ] ,
149- max_retries : Lithic :: Client ::DEFAULT_MAX_RETRIES ,
150- timeout : Lithic :: Client ::DEFAULT_TIMEOUT_IN_SECONDS ,
151- initial_retry_delay : Lithic :: Client ::DEFAULT_INITIAL_RETRY_DELAY ,
152- max_retry_delay : Lithic :: Client ::DEFAULT_MAX_RETRY_DELAY
149+ max_retries : self . class ::DEFAULT_MAX_RETRIES ,
150+ timeout : self . class ::DEFAULT_TIMEOUT_IN_SECONDS ,
151+ initial_retry_delay : self . class ::DEFAULT_INITIAL_RETRY_DELAY ,
152+ max_retry_delay : self . class ::DEFAULT_MAX_RETRY_DELAY
153153 )
154154 base_url ||= Lithic ::Client ::ENVIRONMENTS . fetch ( environment &.to_sym || :production ) do
155155 message = "environment must be one of #{ Lithic ::Client ::ENVIRONMENTS . keys } , got #{ environment } "
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ class PooledNetRequester
1111 # https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49
1212 KEEP_ALIVE_TIMEOUT = 30
1313
14+ DEFAULT_MAX_CONNECTIONS = [ Etc . nprocessors , 99 ] . max
15+
1416 class << self
1517 # @api private
1618 #
@@ -184,7 +186,7 @@ def execute(request)
184186 # @api private
185187 #
186188 # @param size [Integer]
187- def initialize ( size : Etc . nprocessors )
189+ def initialize ( size : self . class :: DEFAULT_MAX_CONNECTIONS )
188190 @mutex = Mutex . new
189191 @size = size
190192 @pools = { }
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ module Lithic
2222 # https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49
2323 KEEP_ALIVE_TIMEOUT = 30
2424
25+ DEFAULT_MAX_CONNECTIONS = T . let ( T . unsafe ( nil ) , Integer )
26+
2527 class << self
2628 # @api private
2729 sig { params ( url : URI ::Generic ) . returns ( Net ::HTTP ) }
@@ -66,7 +68,9 @@ module Lithic
6668
6769 # @api private
6870 sig { params ( size : Integer ) . returns ( T . attached_class ) }
69- def self . new ( size : Etc . nprocessors )
71+ def self . new (
72+ size : Lithic ::Internal ::Transport ::PooledNetRequester ::DEFAULT_MAX_CONNECTIONS
73+ )
7074 end
7175 end
7276 end
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ module Lithic
1515
1616 KEEP_ALIVE_TIMEOUT: 30
1717
18+ DEFAULT_MAX_CONNECTIONS: Integer
19+
1820 def self.connect : (URI::Generic url) -> top
1921
2022 def self.calibrate_socket_timeout : (top conn, Float deadline) -> void
You can’t perform that action at this time.
0 commit comments