File tree Expand file tree Collapse file tree 4 files changed +14
-6
lines changed
rbi/orb/internal/transport
sig/orb/internal/transport Expand file tree Collapse file tree 4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -91,10 +91,10 @@ class Client < Orb::Internal::Transport::BaseClient
9191 def initialize (
9292 api_key : ENV [ "ORB_API_KEY" ] ,
9393 base_url : ENV [ "ORB_BASE_URL" ] ,
94- max_retries : Orb :: Client ::DEFAULT_MAX_RETRIES ,
95- timeout : Orb :: Client ::DEFAULT_TIMEOUT_IN_SECONDS ,
96- initial_retry_delay : Orb :: Client ::DEFAULT_INITIAL_RETRY_DELAY ,
97- max_retry_delay : Orb :: Client ::DEFAULT_MAX_RETRY_DELAY ,
94+ max_retries : self . class ::DEFAULT_MAX_RETRIES ,
95+ timeout : self . class ::DEFAULT_TIMEOUT_IN_SECONDS ,
96+ initial_retry_delay : self . class ::DEFAULT_INITIAL_RETRY_DELAY ,
97+ max_retry_delay : self . class ::DEFAULT_MAX_RETRY_DELAY ,
9898 idempotency_header : "Idempotency-Key"
9999 )
100100 base_url ||= "https://api.withorb.com/v1"
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 Orb
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 Orb
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 : Orb ::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 Orb
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