File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -85,33 +85,16 @@ def build_request(request, &)
8585 # @param url [URI::Generic]
8686 # @param blk [Proc]
8787 #
88- private def with_pool ( url , &blk )
88+ private def with_pool ( url , &)
8989 origin = OpenAI ::Util . uri_origin ( url )
90- th = Thread . current
91- key = :"#{ object_id } -#{ self . class . name } -connection_in_use_for_#{ origin } "
92-
93- if th [ key ]
94- tap do
95- conn = self . class . connect ( url )
96- return blk . call ( conn )
97- ensure
98- conn . finish if conn &.started?
99- end
100- end
101-
10290 pool =
10391 @mutex . synchronize do
10492 @pools [ origin ] ||= ConnectionPool . new ( size : @size ) do
10593 self . class . connect ( url )
10694 end
10795 end
10896
109- pool . with do |conn |
110- th [ key ] = true
111- blk . call ( conn )
112- ensure
113- th [ key ] = nil
114- end
97+ pool . with ( &)
11598 end
11699
117100 # @private
You can’t perform that action at this time.
0 commit comments